CHANGE MASTER TO MASTER_HOST='10.10.30.34', MASTER_PORT=3306, MASTER_USER='slave', MASTER_PASSWORD='slave', MASTER_LOG_FILE='mysql-bin.000148', MASTER_LOG_POS=154; 从数据库变为主库 stop slave; reset slave; reset master; 从库变为刚才的主库(由从库变为主库的数据库) vim /etc/my.cnf log-bin=mysql-bin #并重启数据库,主库开启binlog日志 主库操作:show master status 主库操作:scp -r /var/lib/mysql/* 10.10.50.34:/var/lib/mysql/ 从库:chown -R mysql.mysql /var/lib/mysql/ 从库:systemctl restart mysqld CHANGE MASTER TO MASTER_HOST='172.16.1.51', MASTER_PORT=3306, MASTER_USER='rep', MASTER_PASSWORD='123456', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=335; 进入数据:start slave; 中间报错: 1.IO进程一直处于connnecting中 slave 用户的密码写错 2.show slave status;报错 Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file' 解决办法: 主库:flush logs; 从库: stop slave; CHANGE MASTER TO MASTER_LOG_FILE='mysqld-bin.000011',MASTER_LOG_POS=106; start slave;
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。