首页 > 代码库 > Mysql主从备份、binlog

Mysql主从备份、binlog

### Master Cluster
log-bin=mysql-bin
server-id=1
binlog-do-db=ukjs
expire-logs-days=7


GRANT REPLICATION SLAVE ON *.* TO ‘slave‘@‘192.xx.0.xx‘ IDENTIFIED BY ‘root$%^‘;


start master;
show master status\G;



### Slave Cluster
server-id=2
#master-port=3306
replicate-do-db=ukjs
#replicate-ignore-table=dzx2.pre_common_session
slave-skip-errors=1032,1062,126,1114,1146,1048,1396
log_bin=mysql-bin
relay_log=mysql-relay-bin
log_slave_updates=1
read_only=1


change master to master_host=‘192.xx.0.ssxx‘, master_user=‘slave‘, master_password=‘root$%^‘, master_log_file=‘mysql-bin.000001‘, master_log_pos=2069;


start slave;
show slave status\G;

binlog的路径

系统的时间 是否会影响

从服务器只读,否则会影响同步,从服务器数据更改会影响同步,重新设置同步需要先关闭从服务器stop slave


Mysql主从备份、binlog