mysql設定から読み取り専用
2228 ワード
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