Detecting locked tables (locked by LOCK TABLE)
Use SHOW OPEN TABLES
:
http://dev.mysql.com/doc/refman/5.1/en/show-open-tables.html
You can do something like this
SHOW OPEN TABLES WHERE `Table` LIKE '%[TABLE_NAME]%' AND `Database` LIKE '[DBNAME]' AND In_use > 0;
to check any locked tables in a database.
You can use SHOW OPEN TABLES
to show each table's lock status. More details on the command's doc page are here.
SHOW OPEN TABLES
to show each table status and its lock.
For named locks see Show all current locks from get_lock
The simplest way is :
SHOW OPEN TABLES WHERE In_use > 0
You get the locked tables only of the current database.