Google

Monday, January 5, 2009

Make a trac backup

I was able to make a backup of trac database and import all the data to other machine. So all the tickets, milestones, etc. were imported to another machine. Here is the procedure.

Make a backup of the current database.
mysqldump -u charith -p --databases trac > dbdump.sql
Then I copy it to the target machine and import it and create a new database called "trac" and allow permission to user charith,
grant all privileges on trac.* to charith@localhost identified by 'password';
I tried to use mysqlimport command,
mysqlimport trac --replace --user=root dbdump.sql
mysqlimport: Error: Table 'trac.dbdump' doesn't exist, when using table: dbdump

But I was able to import it successfully as root by,
mysql trac < dbdump.sql
But, still trac give the following error: "The 'repository_dir' has changed, a 'trac-admin resync' operation is needed".
So I synchronize the repository by,
trac-admin /path/to/env/ resync
Finally, I was able to import the data to the new environment.

No comments: