MySQL数据库主从同步备份实例

主数据库IP:192.168.139.133

从数据库IP:192.168.139.134

?

Master数据库的操作:

1.mysql> GRANTSUPER,REPLICATION SLAVE ON *.* TO [email protected] identified by 'slave';

2.vi /etc/mysql/my.cnf

server-id=1

log-bin=/home/mysql/logs/binlog/bin-log

#log_bin?=/var/log/mysql/mysql-bin.log

expire_logs_days?=10

max_binlog_size=100M

binlog_cache_size=128k

binlog_do_db?=student

binlog_ignore_db?=mysql

log-slave-updates

binlog_format="MIXED"

Slave数据库的操作:

1. vi /etc/mysql/my.cnf

?

备份:mysqldump -uroot -phactcmlabs student stu > /tmp/stubackup.sql

恢复:mysql -uroot -phactcmlabs student < /tmp/stubackup.sql

猜你喜欢

转载自www.cnblogs.com/shujutongbugongju/p/11020081.html
今日推荐