问题:mysql需要开启bin_log权限,配置文件添加之后mysql无法启动
修改内容:
#编辑mysql配置文件
#vi /etc/
#添加内容:
log_bin=mysql_bin
binlog_format=ROW
添加之后重启mysql启动失败:
#systemctl restart mysqld
查看状态:
#systemctl status mysqld
提示:start request repeated too quickly for
查看日志文件中没有信息提示
解决方法:在配置文件中添加server_id字段
log_bin=mysql_bin
binlog_format=ROW
server_id=2
添加之后重启服务,mysql启动成功
进入mysql
# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28
Server version: 5.7.18-log MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show variables like 'log_bin';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin | ON |
+---------------+-------+
1 row in set (0.00 sec)
mysql> exit
log_bin开启成功。
原因解析(server_id作用):
添加bin_log的主要目的是用于数据库同步, mysql的同步的数据中是包含server-id的,用于标识该语句最初是从哪个server写入的,所以server-id一定要有的。