Edgewall Software

Version 20 (modified by Jonas Borgström, 13 years ago) ( diff )

Added note about dropped psycopg1 support.

Database Backend

Initially, Trac only supported SQLite for its database backend (see PySqlite).

Postgresql support has been added as of Trac 0.9.

Mysql support will be added for Trac 0.10 (see this status report).

More generally, since milestone:0.10, Trac offers an easily extensible layer for Database support (see trac.db.api).

The existing backends have been refactored and integrated in this layer. There's currently bundled support for:

There's some work in progress for the following:

Backend Specific Installation Instructions


  • Have a working copy of Postgresql
  • Get the proper database driver for Python (see above)
  • Create a database for your Trac environment
    % createdb dbname
  • Run trac-admin to create a new Trac environment. When prompted for a Database connection string, use:

See also #2441, which discusses the process of migration from SQLite to Postgresql.

For a postgresql recipe tested on CentOS4 (Red Hat -EL4) see PostgresqlRecipe.

Note: Since Trac 0.10 the psycopg1 postgresql driver is no longer supported due to lack of unicode support.


MySQL is only experimentally supported with the patch attached to ticket #986. It also has several limitations.

  • Have a working copy of MySQL version 4.1.12 or greater.
  • MySQLdb - Python database driver for MySQL
  • Create a database and user for your Trac environment
    % mysqladmin create dbname
    % mysql
    > grant all privileges on dbname.* to dbuser identified by 'dbpass';
    > quit
  • Run trac-admin to create a new Trac environment. When prompted for a database connection string, use:
  • or

Alternative Ideas for Database Independence

Object-Relational Mapper

An ORM could be used to provide a unified object interface to different RDBMS:

  • some people have been talking about using SQLObject to accomplish this goal of database independence.
  • Modeling Another, more advanced (and more complex) OR-Mapper.
  • SQLAlchemy seems to be also quite advanced

Comparisions between both and more info on Python ORMs:

Store Tickets and Wiki pages directly in the Subversion repository

A compelling idea with many advantages. A page advocating this plan is TighterSubversionIntegration. There has also been a discussion on the Trac mailing list. All arguments from this discussion are summarized on the page WhySQLite.

Other Alternatives

Note: See TracWiki for help on using the wiki.