MySQL更新卡住报错lock wait timeout
先查数据库有没锁:
select * from information_schema.innodb_trx
select * from information_schema.innodb_locks
select * from information_schema.innodb_lock_waits
有所就把锁的进程杀了。
如果没有锁,查看有没未提交事务。
-- 从 information_schema.innodb_trx 表中查看当前未提交的事务
select trx_state, trx_started, trx_mysql_thread_id, trx_query from information_schema.innodb_trx;
-- trx_mysql_thread_id:MySQL的线程ID,用于kill
kill 2199075;
kill 25650928;
杀掉未提交事务,问题解决。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22996654/viewspace-2899030/ ,如需转载,请注明出处,否则将追究法律责任。