PDA

View Full Version : How to test table locking?



phantom007
06-11-2011, 02:06 PM
Hi

I have been reading this (http://aarklondatabasetrivia.blogspot.com/2009/04/how-to-lock-and-unlock-tables-in-mysql.html) tutorial to learn how to read/write lock a table.

But I wish to know how do I test it?

I ran the command


LOCK TABLE users WRITE;

The above code should ideally lock the table for reading/writing to other connections. But when I open phpmyadmin in another browser, i can still read the data of that table.

Is there anyway to test if its working?

Database: MySQL 5.1.41-3
Table Type: MyISAM

Thanks in advance

BubikolRamios
06-13-2011, 04:50 AM
.....



LOCK TABLE users WRITE;
But when I open phpmyadmin in another browser, i can still read the data of that table.

phantom007
06-13-2011, 05:37 AM
.....

I know what are you pointing to..but according to Mysql manual:

If you specify WRITE, the current connection can read or write to the table, but no other connections can access the table until the lock has been removed.