mysql 开启只读 普通用户无法写入

从开启只读,一般用户无法写入:


[root@slave ~]# mysql -uzjzc_app -p1234567 


Database changed
mysql> create table test(id int);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into test values(1);


开启只读,添加read-only

[root@slave ~]# mysql -uzjzc_app -p1234567 


Database changed
mysql> select * from test;
+------+
| id   |
+------+
|    1 |
|    2 |
+------+
2 rows in set (0.00 sec)

mysql> insert into test values(3);
ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement

你可能感兴趣的:(mysql 开启只读 普通用户无法写入)