UNLOCK TABLES is a MySQL and MariaDB command that frees every table lock acquired with LOCK TABLES in the current client session. It restores normal concurrency so that other sessions can read or write the affected tables. UNLOCK TABLES is automatically executed when a COMMIT, ROLLBACK, or connection close occurs, but issuing it explicitly lets you shorten the blocking window and avoid long-running locks. You cannot unlock individual tables; the statement always releases all locks held by the session. UNLOCK TABLES is not part of the ANSI SQL standard and is unsupported in PostgreSQL, SQL Server, SQLite, or Oracle.
MySQL 3.23
Call it immediately after the critical section of code that required explicit locks finishes. Doing so reduces blocking time for other sessions.
No. It only frees table locks. If autocommit is disabled, your transaction remains open until you issue COMMIT or ROLLBACK.
No. Once locks are released, they cannot be re-acquired automatically by rolling back; you must call LOCK TABLES again.
You need the same privileges required for LOCK TABLES (typically SELECT for READ locks and INSERT/UPDATE/DELETE for WRITE locks) on the affected tables.