Does mysql lock tables on select, update or delete?
locking, mysql
Solution
1.a) no lock required 1.b) locks the table (myisam engine) or you have row level locking if your using innodb engine
2.a) locks the table for read operations (until this lock is released no writing operations occur) 2.b) no lock required
As Lithu T.V suggested please read the DOCS to get the all the use cases.
Problem
I have a few questions about MySQL table `lock`. I appreciate if anyone answers :) Does MySQL lock tables automatically in the following cases: - `SELECT id FROM members;` - `UPDATE members SET name = 'john' WHERE id = 7;` What is the difference between these two: - `LOCK TABLE items READ ; SELECT * FROM 'items;` - `SELECT * FROM 'items';` For some reason I was under the impression that MySQL automatically locks the tables on necessary occasions! How can I check when and how the locking happens? Thank you.