mysql慢查询,死锁解决方案
1. 先使用root用户登录到MySQL中
2. 使用show processlist查看其查询速率
+----+------+-----------------+------+---------+-------+-------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+------+-----------------+------+---------+-------+-------+------------------+ | 5 | root | localhost:54309 | emms | Sleep | 35542 | | NULL | | 7 | root | localhost:54777 | emms | Sleep | 31952 | | NULL | | 8 | root | localhost:54778 | emms | Sleep | 33697 | | NULL | | 15 | root | localhost | NULL | Query | 0 | init | show processlist | +----+------+-----------------+------+---------+-------+-------+------------------+ 4 rows in set (0.00 sec)
3.如果在command中出现了select xxx from 则说明该条语句可能卡死在那里了。
找到其id
4. 将使用kill命令进行清除
kill {id};
> 如果是有其他的例如插入等操作,可能会导致脏数据产生,建议进行清理