View: Lock all MySQL databases

  1. 6 months ago by skanx
    Lock a database:
    $ mysql -u user -p
    mysql> FLUSH TABLES WITH READ LOCK;
    This closes all open tables and locks all tables for all databases with a read lock until you execute UNLOCK TABLES.
    
    Unlock:
    mysql> UNLOCK TABLES;
    
    (to lock a single table: LOCK TABLES table READ;)

0 comment about "Lock all MySQL databases"