主库配置
#主库库名可以选指定的一个或者多个库名,也可以指定除某几个库名之外的库
server-id=1
binlog-format=MIXED
log-bin=mysql-binlog
#binlog-do-db=mall
#binlog-do-db=goods
binlog-ignore-db=information_schema
binlog-ignore-db=test
binlog-ignore-db=mysql
binlog-ignore-db=sys
#binlog-do-db=mall 这样就是指定要复制的库名
#binlog-ignore-db=test 这样就是忽略的库
server-id=1
binlog-format=MIXED
log-bin=mysql-binlog
#binlog-do-db=mall
#binlog-do-db=goods
binlog-ignore-db=information_schema
binlog-ignore-db=test
binlog-ignore-db=mysql
binlog-ignore-db=sys
#binlog-do-db=mall 这样就是指定要复制的库名
#binlog-ignore-db=test 这样就是忽略的库
从库配置
server-id=119
master-info-repository=TABLE
relay-log-info-repository=TABLE
slave-skip-errors=all
从库执行脚本
在从服务器上执行下面sql操作:
首先输入命令:slave stop;
然后输入:Mysql > change master to
—>master_host=’master_host_name’,#主机IP地址
—>master_user=’replication_user_name’,
—>master_password=’replication_password’,
—>master_log_file=’recorded_log_file_name’,
—>master_log_pos=’recorded_log_position’;
最后输入命令:slave start;
CHANGE MASTER TO MASTER_HOST='
10.100.100.62', MASTER_USER='root', MASTER_PORT=3306, MASTER_PASSWORD='******'
FOR CHANNEL 'master62';
FOR CHANNEL 'master62';