SQL dumping is locking the database and crashing my website [duplicate]
Possible Duplicate:
Run MySQLDump without Locking Tables
My website uses a mysql 5 database with a MyISAM engine.
I would like to use mysqldump to back up the database or create copies of it, but whenever I use it, it locks the database, thus crashing my website..
Any ideas on how to back up my database without causing downtime?
If your database relies on any kind of referential integrity, it'll be essential to lock at least parts of it whilst performing a dump. (Otherwise, you'll get snapshots of the various tables at different times, which is likely to cause issues.)
That said, unless you have a very, very large database this shouldn't be a significant issue. (i.e.: It really shouldn't take that long.) How much data is in the database?
Update:
You can use the --lock-tables=false
mysqldump option, but you need to be aware of the consequences of this as outlined above.
精彩评论