Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running mysqldump on live database

Tags:

mysql

Just wanted to know what are the risks of running a mysqldump on a live database? Are there any chances of database corruption? mysqldump seems to lock the entire database.

like image 877
rpat Avatar asked Feb 24 '12 14:02

rpat


1 Answers

What engine are your database tables using? If you are using transactional tables you can dump using the option "single-transaction", which will dump your tables in a consistent state. If you are using tables like MyISAM, which are non transactional, you should not have any DB corruption issues. You may have inconsistent data problems however, if you get into a race scenario. In either case, you will be dramatically slowing down DB response time while the dump occurs. Best bet is to run the dump against a slave or to wait for the site to be quiescent before running the dump.

like image 127
rpierce Avatar answered Nov 15 '22 01:11

rpierce