zoukankan      html  css  js  c++  java
  • [Err] 1205

    这个错误是由于当前操作的记录存在于数据库中未结束的事务导致行锁定。

    简单说,就是现在要对一条记录进行修改,那么sql语句应该是这样的:

    update user set uname = 'zhangsan' where uid = 1

    如果执行这条sql语句,发现一直处于处理中的状态,然后等一定时间(超时)后报错[Err] 1205 - Lock wait timeout exceeded; try restarting transaction 。

    说明 uid = 1 的这条记录正处于一个未结束的事务中。

    MySQL - 锁等待超时与information_schema的三个表:
    -- 1.information_schema.innodb_trx–当前运行的所有事务
    select * from information_schema.innodb_trx;

    -- information_schema.innodb_locks–当前出现的锁
    select * from information_schema.innodb_locks;

    -- information_schema.innodb_lock_waits–锁等待的对应关系
    select * from information_schema.innodb_lock_waits;
    --------------------------------------------------------------
    select concat('kill',' ',trx_mysql_thread_id,';') from information_schema.innodb_trx

  • 相关阅读:
    单例 与 static
    ActiveMQ 核心概念
    Jconsole
    死锁
    document write & close
    java.nio.Buffer
    Java 线程控制(输出奇偶数)
    exist & in
    命运
    Super Jumping! Jumping! Jumping!
  • 原文地址:https://www.cnblogs.com/tongcc/p/13741334.html
Copyright © 2011-2022 走看看