With read-only, you can leave the entire mysqld instance in a read-only state, but be aware that there is no limit to read-only for super users with full permissions. Therefore, we can only provide access to ordinary users.
Read-only can be used for master-slave synchronization from the library, can be easily implemented from the library security.
The method of setting is simple, there are two kinds of
1) Enter read-only in my.cnf [mysqld] and start the service;
2) Online input
mysql> set global read_only= ' on '; Query OK, 0 rows Affected (0.00 sec) mysql> Show variables like ' read_only '; +---------------+-------+| variable_name | Value |+---------------+-------+| Read_Only | On |+---------------+-------+1 row in Set (0.00 sec)
It is important to note that in the configuration file, the name of the parameter is used more than the cross-bar, and in the case of online input, the parameter name is used more underlined _; In addition, when online input, this parameter is the global parameter, so the method of setting is set global
Attempting to modify data from another client will prompt the MySQL server to be running in a read-only state.
[Email protected] ~]# mysql-uweb-pweb123-h 192.168.5.41-e "Delete from mydb.student where name= ' webtest ';" ERROR 1290 (HY000) at line 1:the MySQL Server was running with the--read-only option so it cannot execute this statement
Linux Learning Note: read-only parameters