开发者

How do I lock a MySQL DATABASE so that write/read/update/delete ..everything is locked?

I want to lock everything--completely. Very simple. Just prevent things from changing!! Will this work?

use mydatabase;开发者_StackOverflow
flush tables with read lock;

...

unlock tables;

Edit: But, it has to be available for replication.


Wouldn't it be simpler to adjust the security for the user account accessing the database so that it only has read access?


This closes all open tables and locks all tables for all databases with a read lock until you execute UNLOCK TABLES.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜