Simplify your business
Monday, 13 October 2008 10:44 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.

Posted in Database, Linux, SQL, Tips by Ivan
Blinklist icon Del.iocio.us icon Furl icon Reddit icon Technorati icon Yahoo! icon

Got something to say?

To protect your privacy, your email address will not be displayed.





Some basic rules for commenting:

  • Watch your language.
  • Keep comments on-topic and relevant.
  • You can use basic XHTML tags for formatting and linking but not bbcode.
  • Comments are moderated, so don't double post if your comment doesn't appear immediately.
  • Please proof-read your comments for spelling and grammar mistakes.
  • Watch your language.