Mysql基础——shell环境查看数据库mysql的只读参数

以下给出 MySQL 主备(主从)架构 中常用、与“只读”相关的全局变量 的查询方式及含义,方便你快速确认主库、备库各自的只读配置。

1. 查看当前实例只读相关参数

sql代码
SHOW GLOBAL VARIABLES
WHERE Variable_name IN (
    'read_only',
    'super_read_only',
    'transaction_read_only'
);

image

 

image

 

image

2. 查看数据库全局变量参数

[root@harbor harbor]# mysql -h172.27.0.2 -P3306 -uroot -p -e "SHOW GLOBAL VARIABLES LIKE '%read_only%';"
Enter password:
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| innodb_read_only      | OFF   |
| read_only             | OFF   |
| super_read_only       | OFF   |
| transaction_read_only | OFF   |
| tx_read_only          | OFF   |
+-----------------------+-------+

 

posted on 2025-08-12 16:59  gkhost  阅读(7)  评论(0)    收藏  举报

导航