mysql 1205 lock wait timeout exceeded

最近网站经常报锁表的错误,系统用的是magento,innodb表,在事物在更新或插入后没有执行commit操作,并且超过了设置的最大等待时间(默认innodb_lock_wait_timeout=50),一旦超过就会报mysql 1205 lock wait timeout exceeded

在网上找了很多,解决的方案很少,大都都是show processlist,然后kill进程,但是这治标不治本

最后在google上看到有2中解决方案

1) either contact your hosting provided and ask to increase the time out :

[mysqld]
innodb_lock_wait_timeout=120

2) or you can try below trick buy running query in phpmyadmin :

 
 
create index core_session_index on core_session (session_id);
create index core_session_index_date on core_session (session_expires);
 
目前我先改了innodb锁表超时时间,观察一段时间有没有错误发生
原文地址:https://www.cnblogs.com/you-jia/p/4732771.html