Simplify your business
Tuesday, 7 October 2008 1:11 pm

MySQL backup

Tuesday, 14 June 2005  

For those of you lucky enough to have Linux shell access here’s a quick tip for backing up and restoring your MySQL database:

Backup:

mysqldump -u username -p --opt databasename | gzip -9 > dumpfilename.sql.gz

Restore:

gunzip dumpfilename.sql.gz
mysql -u username -p databasename < dumpfilename.sql

Where "databasename" is the name of your MySQL database, "dumpfilename" is the name of the backup/restore file and "username" is your MySQL username.


Previous page