support for [http://mysql.com/ MySQL] was added in 0.10. The default is

28

to use SQLite, which is probably sufficient for most projects. The database

29

file is then stored in the environment directory, and can easily be

30

[wiki:TracBackup backed up] together with the rest of the environment.

31

32

=== Embedded SQLite Connection String ===

33

The connection string for an embedded SQLite database is:

34

{{{

35

sqlite:db/trac.db

36

}}}

37

38

=== PostgreSQL Connection String ===

39

If you want to use PostgreSQL or MySQL instead, you'll have to use a

40

different connection string. For example, to connect to a PostgreSQL

41

database on the same machine called `trac`, that allows access to the

42

user `johndoe` with the password `letmein`, use:

43

{{{

44

postgres://johndoe:letmein@localhost/trac

45

}}}

46

''Note that due to the way the above string is parsed, the "/" and "@" characters cannot be part of the password.''

47

48

If PostgreSQL is running on a non-standard port (for example 9342), use:

49

{{{

50

postgres://johndoe:letmein@localhost:9342/trac

51

}}}

52

53

On UNIX, you might want to select a UNIX socket for the transport,

54

either the default socket as defined by the PGHOST environment variable:

55

{{{

56

postgres://user:password@/database

57

}}}

58

or a specific one:

59

{{{

60

postgres://user:password@/database?host=/path/to/socket/dir

61

}}}

62

63

Note that with PostgreSQL you will have to create the database before running

64

`trac-admin initenv`.

65

66

See the [http://www.postgresql.org/docs/ PostgreSQL documentation] for detailed instructions on how to administer [http://postgresql.org PostgreSQL].

67

Generally, the following is sufficient to create a database user named `tracuser`, and a database named `trac`.

68

{{{

69

createuser -U postgres -E -P tracuser

70

createdb -U postgres -O tracuser -E UTF8 trac

71

}}}

72

When running `createuser` you will be prompted for the password for the user 'tracuser'. This new user will not be a superuser, will not be allowed to create other databases and will not be allowed to create other roles. These privileges are not needed to run a trac instance. If no password is desired for the user, simply remove the `-P` and `-E` options from the `createuser` command. Also note that the database should be created as UTF8. LATIN1 encoding causes errors trac's use of unicode in trac. SQL_ASCII also seems to work.

73

74

Under some default configurations (debian) one will have run the `createuser` and `createdb` scripts as the `postgres` user. For example: