判断MySQL是否已经开启binlog
SHOW VARIABLES LIKE 'log_bin';
mysql> SHOW VARIABLES LIKE 'log_bin'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | log_bin | OFF | +---------------+-------+ 5 rows in set (0.00 sec)
进入my.cnf 配置 Mysql
#一个随机的id server-id=1 #/data/mysql_data3307/具有路径作用,mysql-bin生成文件的前缀 log-bin=/data/mysql_data3307/mysql-bin binlog-format=ROW
重启 Mysql
# CentOS 6 service mysqld restart # CentOS 7 systemctl restart mysqld
若增加后无法启动MySQL,考虑SELinux问题。
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
不需要重启Linux,输入命令:
setenforce 0