read-only
该选项限制普通用户只有select权限
--read_only Make all non-temporary tables read-only, with the
exception for replication (slave) threads and users with
the SUPER privileg
使所有的非temporary表为只读,除了复制的threads和超级用户
超级用户:
SUPER privilege :
The SUPER privilege enables an account to use CHANGE MASTER TO , KILL or mysqladmin kill to kill threads belonging to other accounts (you can always kill your own threads), PURGE BINARY LOGS ,
configuration changes using SET GLOBAL to modify global system variables, the mysqladmin debug command, enabling or disabling logging, performing updates even if the read_only system variable is
enabled, starting and stopping replication on slave servers, specification of any account in the DEFINER attribute of stored programs and views, and enables you to connect (once) even if the
connection limit controlled by the max_connections system variable is reached.
To create or alter stored routines if binary logging is enabled, you may also need the SUPER privilege, as described in Section 18.6, “Binary Logging of Stored Programs”
超级权限可以让一个账户使用CHANGE MASTER TO ,KILL或者mysqladmin kill 来kill 进程属于另外的账户(你也可以kill 你自己的threads),PURGE BINARY LOGS,
配置改变使用SET GLOBAL 来修改全局系统变量,mysqladmin debug 命令,启用或者关闭logging,执行更新 甚至read_only 系统变量是启用的,启动和关闭复制在slave servers上,
指定任何账户在存储程序和视图的定义属性。
测试:
slave:/etc# mysql -uzjzc_app -p1234567
1.对应用用户无法写入和修改
mysql> use zjzc;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from test;
+------+
| id |
+------+
| 1 |
| 2 |
| 3 |
+------+
3 rows in set (0.00 sec)
mysql> insert into test values(4);
ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement
此时zjzc_app用户 不能对表test进行插入
2.对复制用户不影响
mysql> select * from test;
+------+
| id |
+------+
| 1 |
| 2 |
| 3 |
+------+
3 rows in set (0.00 sec)
mysql> select * from test;
+------+
| id |
+------+
| 1 |
| 2 |
| 3 |
| 100 |
+------+
4 rows in set (0.00 sec)
3.对root用户不影响
mysql 从设置只读
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
cfs文件系统只读监控
为确保文件系统可用性,防止出现只读、挂载失败等异常,现对改文件系统进行监控。
文件系统 定时任务 cfs 文件只读 read only -
Oracle创建只读账户
Oracle创建只读账户
用户名 oracle ide