输入banner图图片脚本导航/分类

MySQL设置只读模式

set global read_only=1; Query OK, 0 rows affected (0.00 sec)

授权普通MySQL测试账号

mysql> grant select,insert,update,delete on s18.* to test@127.0.0.1 identifi
ed by 123456;
Query OK, 0 rows affected, 1 warning (0.00 sec)

用测试账号登陆进行删除等操作,会提示--read-only错误

mysql> delete from student where sid=14;
ERROR 1290 (HY000): The MySQL server is running with the --read-only option so i
t cannot execute this statement

mysql> insert class values(5,三年级十班);
ERROR 1290 (HY000): The MySQL server is running with the --read-only option so i
t cannot execute this statement

注意:set global read_only=1 对拥有super权限的账号是不生效的,所以在授权账号的时候尽量避免添加super权限

MySQL设置只读模式

标签:update   weight   连接   操作   从库   code   方法   err   lob