Nov 1, 2018

How to put MySQL in read-only state

To put MySQL in read-only state

mysql> FLUSH TABLES WITH READ LOCK;
mysql> SET GLOBAL read_only = ON;

To restore MySQL to its normal operational state:

mysql> SET GLOBAL read_only = OFF;
mysql> UNLOCK TABLES;