mysql> set global read_only=0;
Query OK, 0 rows affected (0.00 sec) mysql> show variables like '%read_only%';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| innodb_read_only | OFF |
| read_only | OFF |
| tx_read_only | OFF |
+------------------+-------+
3 rows in set (0.00 sec) mysql> set global read_only=1;
Query OK, 0 rows affected (0.00 sec) mysql> show variables like '%read_only%';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| innodb_read_only | OFF |
| read_only | ON |
| tx_read_only | OFF |
+------------------+-------+
3 rows in set (0.00 sec) set global read_only=0; 关闭只读,可以读写 set global read_only=1; 开始只读模式