
复制# 查看 read_only 参数             mysql> show global variables like%read_only%;             +-----------------------+-------+            | Variable_name         | Value |             +-----------------------+-------+            | innodb_read_only      | OFF   |             | read_only             | OFF   |             | super_read_only       | OFF   |             | transaction_read_only | OFF   |             | tx_read_only          | OFF   |             +-----------------------+-------+            # 动态修改 read_only 参数 (若想重启生效 则需将 read_only = 1 加入配置文件中)             mysql> setglobal read_only = 1;             Query OK,你会吗 0 rows affected (0.00 sec)             mysql> show global variables likeread_only;             +---------------+-------+            | Variable_name | Value |             +---------------+-------+            | read_only     | ON    |             +---------------+-------+            # read_only 开启的情况下 操作数据             # 使用超级权限用户             mysql> createtable tb_a (a int);             Query OK, 0 rows affected (0.05 sec)             # 使用普通权限用户             mysql> createtable tb_b (b int);              ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement            # 开启 super_read_only,
亿华云再次使用超级权限用户来操作数据             mysql> setglobal super_read_only = 1;             Query OK,置数
 0 rows affected (0.00 sec)             mysql> show global variables likesuper_read_only;             +-----------------+-------+            | Variable_name   | Value |             +-----------------+-------+            | super_read_only | ON    |             +-----------------+-------+            mysql> createtable tb_c (c int);               ERROR 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement            # 关闭 read_only 参数             mysql> setglobal read_only = 0;             Query OK, 0 rows affected (0.00 sec)             1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.
WordPress模板