MYSQL死锁

转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://www.blogbus.com/ri0day-logs/59186177.html

mysql使用myisam的时候锁表比较多,尤其有慢查询的时候,造成死锁.这时需要手动kill掉locked的process.使他释放.

(以前我都是重起服务)..惭愧啊..MYSQL死锁

演示:(id 7是我用python 来连过来的一个会话,虽然是状态是sleep,为了演示,干掉他)

mysql> show processlist;
+----+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host      | db   | Command | Time | State | Info             |
+----+------+-----------+------+---------+------+-------+------------------+
|  7 | root | localhost | yy   | Sleep   |  154 |       | NULL             | 
|  8 | root | localhost | NULL | Query   |    0 | NULL  | show processlist | 
+----+------+-----------+------+---------+------+-------+------------------+
2 rows in set (0.00 sec)

mysqlkill 7
    -> ;

mysql> show processlist;
+----+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host      | db   | Command | Time | State | Info             |
+----+------+-----------+------+---------+------+-------+------------------+
|  8 | root | localhost | NULL | Query   |    0 | NULL  | show processlist | 
+----+------+-----------+------+---------+------+-------+------------------+
1 row in set (0.00 sec)

上一篇:第三百一十四节,Django框架,自定义分页


下一篇:OJ题:输入一个多位的数字,求各数位相加。