Tips & Tricks
Locking Database
How to make a MySQL server read only to all users?
In order to make all the databases of a MySQL server read only to all users including super user, set super_read_only
variable to ON
.
In order to make the database writable again set super_read_only
variable to OFF
.
How to make a MySQL server read only to all user except the super user?
In order to make all the databases of a MySQL server read only to all users except the super user, set read_only
variable to ON
.
In order to make the database writable again set read_only
variable to OFF
.
How to lock all tables?
In order to lock all tables user FLUSH TABLES WITH READ LOCK;
syntax.
How to lock a single table table?
In order to lock a table to make sure that no other client update it during query, use LOCK TABLES
syntax.
Last updated