MYSQL Error Code: 1175和Lock wait timeout exceeded处理

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xu622/article/details/84388381

Lock wait timeout exceeded解决办法

Java执行一个SQL查询未提交,遇到1205错误。

java.lang.Exception:

Error updating database.  Cause: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction

解决办法:

执行mysql命令:show full processlist;

查看事务表: select * from information_schema.innodb_trx;

然后找出查询语句的系统id:kill掉被锁住的线程id

(没有看到正在执行的很慢SQL记录线程,再去查看innodb的事务表INNODB_TRX,看下里面是否有正在锁定的事务线程,看看ID是否在show full processlist里面的sleep线程中,如果是,就证明这个sleep的线程事务一直没有commit或者rollback而是卡住了,我们需要手动kill掉)

Error Code: 1175

MySql 执行 DELETE FROM Table 时,报

Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect.

错误,这是因为 MySql 运行在 safe-updates模式下,该模式会导致非主键条件下无法执行update或者delete命令,执行命令如下命令

SET SQL_SAFE_UPDATES = 0;

猜你喜欢

转载自blog.csdn.net/xu622/article/details/84388381
今日推荐