1. 程式人生 > >mysql5.7 遷移以及從庫提升為主庫

mysql5.7 遷移以及從庫提升為主庫

mysql

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;


mysql5.7 遷移以及從庫提升為主庫