这种一般是等锁超时了,可以设置延长等锁时间。

mysql> set innodb_lock_wait_timeout=100

Query OK, 0 rows affected (0.02 sec)
查询当前等锁时间
mysql> show variables like 'innodb_lock_wait_timeout';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| innodb_lock_wait_timeout | 100   |
+--------------------------+-------+
但我们更倾向于找出耗时长的sql,看是哪里hold住了。
SHOW ENGINE INNODB STATUS\G 

You can see list of locked tables by-

 show open tables where in_use>0;

查看当前在用的线程。

show full processlist;
如果是之前的线程,可以查看慢日志。先到 Mysql的配置文件查看slow log的日志目录,再到该目录查看日志。

相关文章:

  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2021-12-16
  • 2021-07-19
  • 2021-11-21
  • 2021-07-14
猜你喜欢
  • 2021-12-02
  • 2021-08-26
  • 2021-11-06
相关资源
相似解决方案