在mysql5.7版本开启binlog(在配置文件中添加log_bin=mysqlbinlog)的时候会报错,查看错误日志发现如下错误:
2019-04-08T07:35:16.245337Z 0 [ERROR] You have enabled the binary log, but you haven't provided the mandatory server-id. Please refer to the proper server start-up parameters documentation
2019-04-08T07:35:16.245412Z 0 [ERROR] Aborting
这个错误的意思是:你已经开启了二进制日志,但是还没有提供强制的服务器id,请参考适当的服务器启动参数文档。
意识到这个错误,所以我在配置文件中又加了一行server-id=10
[root@rhel1 ~]# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
slow_query_log=1
long_query_time=2
log_queries_not_using_indexes=1
server-id=10
log_bin=mysqlbinlog
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
default_time_zone=Asia/Shanghai
lo