2

I use mysqldump for MySQL Backup.

mysqldump --lock-tables....

The DB is about 2GB, hence mysqldump takes a long time. If anyone tries to access the DB during backup, I would like to flash a message saying "the DB is being backed-up, please return back after 10 minutes"

My questions is using PHP script, how can I check if mysql table is locked or not.

Thank you in advance.

Best regards, Sanjay

2 Answers 2

2

Prefer method will be setup replication,
and mysqldump on the slave instead on master (assuming only master is serving requests)

So, you never experiencing downtime

Sign up to request clarification or add additional context in comments.

Comments

1

If you have both read/write lock you can write a php script that try to access/write in a table, if it is locked the MySQL server will rise an error and you will be able to evaluate the code and send a message if the error is because the tables are locked.

HTH!

EDIT: You can take a look of the MySQL GET_LOCK function

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.