MySQL 查询锁、解锁语句

一:锁表:

锁定数据表,避免在备份过程中,表被更新

mysql>LOCK TABLES tbl_name READ;

为表增加一个写锁定:

mysql>LOCK TABLES tbl_name WRITE;

二:查询mysql 哪些表正在被锁状态

show OPEN TABLES where In_use > 0;

三:mysql解锁

第一种

show processlist;

找到锁进程,kill id ;

第二种

mysql>UNLOCK TABLES;

 

摘自『http://www.cnblogs.com/Alight/p/4193439.html』

No Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

粤ICP备15062915号-1