Custom Search

Thursday, March 28, 2013

How to reproduce MySQL ERROR 1205 Lock wait timeout exceeded

How to reproduce MySQL ERROR 1205 Lock wait timeout exceeded

1)
Goto mysql Prompt and check default value of innodb_lock_wait_timeout
mysql> show variables like 'innodb_lock_wait_timeout';

2)
Open /etc/mysql/my.cnf and add
[mysqld]
innodb_lock_wait_timeout=3

3)
Restart mysql
#/etc/init.d/mysql restart



 
4)
Goto mysql Prompt and check the new value of innodb_lock_wait_timeout
mysql> show variables like 'innodb_lock_wait_timeout';

5)
Open a mysql prompt and select a database, begin a transaction, run a update query (don't commit the transacion).
mysql> use mydb1
mysql> begin;
mysql> update mytable set name="blabla" where id=2;

6)
Open another mysql prompt and select same database, Try to delete the rows which were updated in first mysql prompt.
mysql> use mydb1
mysql> begin;
mysql> delete from mytable where id=2;

No comments:

Post a Comment