I am going to migrate a LAMP server tonight, it uses php and mysql with apache on centos. I want to stop people from accessing the site/database while I back it up. Will stopping httpd be a sufficient way to stop people from accessing the DB, and will I be able to do mysqldump during this time? There are no other DB connectors that connect to this mysql other than the php running as an apache mod.
Asked
Active
Viewed 92 times
1 Answers
2
Just issue a:
mysql> FLUSH TABLES WITH READ LOCK;
Then back up your database.

EEAA
- 109,363
- 18
- 175
- 245
-
But be careful, as `FLUSH TABLES WITH READ LOCK;` can cause problems and even downtime. Just check it afterwards and resolve any problems. See http://www.mysqlperformanceblog.com/2012/03/23/how-flush-tables-with-read-lock-works-with-innodb-tables/ – Stefan Lasiewski Mar 02 '13 at 03:19
-
@StefanLasiewski - excellent point. – EEAA Mar 02 '13 at 03:32