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

No comments:

Post a Comment