Showing posts with label locking a table with mysql. Show all posts
Showing posts with label locking a table with mysql. Show all posts

Friday, July 9, 2010

How to lock a table in Mysql

in a session
use following
--> lock tables mySchema.myTable write;
In another session try to get
-->select count(*) from mySchema.myTable;

It will be locked till u say

--> unlock tables