MySql锁表解表

来源:互联网 发布:VB用迭代法求方程的根 编辑:程序博客网 时间:2024/06/10 15:32
show OPEN TABLES where In_use > 0;SHOW PROCESSLIST搜索查看数据库中表的状态,是否被锁;kill id   //杀掉被锁的表===================================================set autocommit=0;select * from t1  where uid='xxxx' for update    //在有索引(例如uid)的情况下是行锁,否则是表锁insert into t1 values(1,'xxxxx');commit;=====================================================lock tables t1 write|read;insert into t1 values(2,'xxxxx'); //只有insertunlock tables;

 

0 0
原创粉丝点击