0

Let's say a coworker does LOCK TABLES table_name and then leaves for the day without unlocking the table. Maybe their computer is locked so you can't just kill the process on their computer. Maybe you could unplug their computer but that might not always be an option.

UNLOCK TABLES only unlocks the tables that you locked. At least so it seems to me. SHOW FULL PROCESSLIST to get the query ID and then killing that query ID wouldn't do the trick either because LOCK TABLES table_name isn't still running.

So short of rebooting the DB server what options exist?

neubert
  • 15,947
  • 24
  • 120
  • 212
  • 1
    Killing the process will do it. Locks are associated with a connection, and all locks are released when the connection goes away. – Barmar Sep 30 '21 at 18:05
  • Killing the process holding the lock doesn't result in the lock being released and the active transaction being rolled back? That should be fundamental to any RDBMS. – Jeff Holt Sep 30 '21 at 18:06
  • @Barmar Killing the process might not be the easiest if they left their computer on and walked away. I mean, I guess you could pull the power but if they're working from home and decided to go meet up with some friends after then not even that would work.. BUT that is still good to know! – neubert Sep 30 '21 at 18:51
  • 1
    @neubert It kills the MySQL connection, the client application will get an error. – Barmar Sep 30 '21 at 18:53

0 Answers0