0
点赞
收藏
分享

微信扫一扫

mysql 的主从备份


mysql 的主从备份_重启

mysql 的主从备份_服务器配置_02

master

master 新增用户

mysql>grant replication slave on *.* to 'repl'@'%' identified by 'repl';
mysql>flush privileges;

master my.cnf

server-id=50
log-bin=/var/lib/mysql/mysql-bin
binlog-do-db=demo1
log-slave-updates=1

重启

mysqld restart

mysql>flush tables with read lock;

mysql> show master status; (此处记住File名称和Position值,后面slave服务器配置时需要用到)

mysqldump test > test.sql

mysql>unlock tables;

slave

slave my.ini

server-id=109

启动slave

mysqld restart;

mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)

mysql> change master to
   -> master_host='192.168.0.107',
   -> master_user='repl',
   -> master_password='repl',
   -> master_log_file='mysql-bin.000001',
   -> master_log_pos=713;

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

mysql> show slave status\G;

举报

相关推荐

0 条评论