mysql主从双向备份
2017年3月5日
iptables -L
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -A INPUT -p tcp -m tcp --sport 3306 -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 3306 -j ACCEPT
iptables-save
/etc/init.d/mysql restart
iptables-save > /etc/iptables.up.rules
iptables-restore < /etc/iptables.up.rules
改变
#binlog_do_db = kuaidi
binlog_ignore_db = phpmyadmin
binlog_ignore_db = mysql
replicate-do-db=kuaidi
show master status\G
mysql -u root -p
在从服务器上设置主服务器信息:
CHANGE MASTER TO
MASTER_HOST='122.114.232.157',
MASTER_USER='slave',
MASTER_PASSWORD='******',
MASTER_LOG_FILE='mysql-bin.000022',
MASTER_LOG_POS=167794;
start slave;