tags:

views:

110

answers:

1

I have searched many threads and stackoverflow but I couldn't found any solution. I am trying to insert records into few innodb tables randomly rather one condition matches which cause whole database down. I am getting this error "Lock wait timeout exceeded; try restarting transaction"

One the question (#1103248) has been answered here

In InnoDB, an insert on an auto-increment column results in a table lock. Selecting a row FOR UPDATE results in a row level lock.

All tables are just used for inserts none of them table performs updated at all. My question is how do I avoid these locks? Is there any solution available?

A: 

Here is the solution I found.

  • I installed the mysql 5.1
  • I have put following variable in my.cnf innodb_autoinc_lock_mode = 2
  • Restart mysql all should be set!

Thanks every one for your help.

Jason