Mysql的read_only 只读属性说明 (运维笔记)

在MySQL数据库中,在进行数据迁移和从库只读状态设置时,都会涉及到只读状态和Master-Slave主从关系设置, 以下针对real_only只读属性做些笔记记录:
1) 对于MySQL单实例数据库和master库,如果需要设置为只读状态,需要进行如下操作和设置: 将MySQL设置为只读状态的命令:
mysql> show global variables like "%read_only%";
mysql> flush tables with read lock;
mysql> set global read_only=1;