MySQL data is gathered by the Cedar Backup mysql extension. This extension always creates a full backup each time it runs. This wastes some space, but makes it easy to restore database data. The following procedure describes how to restore your MySQL database from the backup.
I am not a MySQL expert. I am providing this information for reference. I have tested these procedures on my own MySQL installation; however, I only have a single database for use by Bugzilla, and I may have misunderstood something with regard to restoring individual databases as a user other than root. If you have any doubts, test the procedure below before relying on it!
MySQL experts and/or knowledgable Cedar Backup users: feel free to write me and correct any part of this procedure.
First, find the backup you are interested in. If you have specified
“all databases” in configuration, you will have a single
backup file, called mysqldump.txt
. If you have
specified individual databases in configuration, then you will have
files with names like mysqldump-database.txt
instead. In either case, your file might have a
.gz
or .bz2
extension
depending on what kind of compression you specified in configuration.
If you are restoring an “all databases” backup, make sure that you have correctly created the root user and know its password. Then, execute:
daystrom:/# bzcat mysqldump.txt.bz2 | mysql -p -u root
Of course, use zcat or just cat, depending on what kind of compression is in use.
Because the database backup includes CREATE
DATABASE
SQL statements, this command should take care of
creating all of the databases within the backup, as well as populating
them.
If you are restoring a backup for a specific database, you have two choices. If you have a root login, you can use the same command as above:
daystrom:/# bzcat mysqldump-database.txt.bz2 | mysql -p -u root
Otherwise, you can create the database and its login first (or have someone create it) and then use a database-specific login to execute the restore:
daystrom:/# bzcat mysqldump-database.txt.bz2 | mysql -p -u user database
Again, use zcat or just cat as appropriate.
For more information on using MySQL, see the documentation on the MySQL web site, http://mysql.org/, or the manpages for the mysql and mysqldump commands.