Monday, April 12, 2010

Backing up a live MySQL DB w/o Locking its tables!

I recently had a project that we have to build a back up tool for our databases. Along time ago I was told by a supervisor that it was essentially impossible to back up a live sql DB with out locking its tables. After literally 5 to 10 minutes of googling and looking through documentation I came up with this, and it works!

mysqldump -u username -ppassword -h hostname --opt --skip-lock-tables --single-transaction db_name > db_name.sql

Hope this helps!

No comments: