实施同事用我给的文档部署mysql主主配置的时候,发现binlog没有启动
我看了下配置:
my.cnf
[client]
port=3306
socket=/mnt/hwb/mysql/mysqlinstall/public/mysql/mysql.sock
[mysql]
server-id=1
auto_increment_offset=1
auto_increment_increment=2
default-character-set=utf8
log-bin=mysql-bin
log-slave-updates=true
#gtid-mode=on
#enforce-gtid-consistency=truemasterB:
master-info-repository=TABLE
relay-log-info-repository=TABLE
sync-master-info=1
slave-parallel-workers=0
sync_binlog=0
max_binlog_size=100M
binlog_format=row
expire_logs_days = 15
innodb_flush_log_at_trx_commit=0
replicate_wild_ignore_table =mysql.%
replicate_wild_ignore_table =test.%
replicate_wild_ignore_table =information_schema.%
replicate_wild_ignore_table =performance_schema.%
max_connect_errors=30
slave_skip_errors=ddl_exist_errors
skip-character-set-client-handshake
init-connect='SET NAMES utf8'
character-set-server=utf8
wait_timeout=1800
interactive_timeout=1800
skip-name-resolve
no-beep
[mysqld]
basedir=/mnt/hwb/mysql/mysqlinstall/public/mysql
datadir=/mnt/hwb/mysql/mysqlinstall/public/mysql/data
port=3306
socket=/mnt/hwb/mysql/mysqlinstall/public/mysql/mysql.sock
log_error=/mnt/hwb/mysql/mysqlinstall/public/mysql/error.log
character-set-server=utf8
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
default-storage-engine=INNODB
max_connections=1000
lower_case_table_names=1
skip-name-resolve
发现有:“log-bin=mysql-bin”说明是设置了启动binlog的,在客户端执行命令:
第一次遇到执行show master status;
什么都没有,在网上搜索了很多为了binlog设置失败,找不到问题,于是问了一个大神,大神说:
所有参数要写到[mysqld]下面
顿时一惊,然后明白了问题,因为配置文件一开始不是本人加的,还没注意这个问题。
附上一个链接:http://blog.itpub.net/31397003/viewspace-2651459/
关于my.cnf里面几个配置的区别:
[client]代表客户端默认设置内容;
[mysql]代表我们使用mysql命令登录mysql数据库时的默认设置;
[mysqld]代表数据库自身的默认设置;
修改后,重新执行启动,没问题了,特此记录下。
与君共勉!