您好,登錄后才能下訂單哦!
MySQL數據庫中怎么實現主備切換,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。
show processlist; Master has sent all binlog to slave; waiting for binlog to be updated show master status \G
show processlist; show slave status \G
stop slave IO_THREAD; show processlist; show slave status \G
stop slave; reset master; reset slave all; show master status \G
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user; GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%' IDENTIFIED BY 'xxx; FLUSH PRIVILEGES;
reset master; reset slave all; CHANGE MASTER TO MASTER_HOST='1xxx', MASTER_USER='repl', MASTER_PASSWORD='xxx, MASTER_PORT=3306, MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=589;
SHOW PROCESSLIST; show master status \G
SHOW PROCESSLIST; start slave; show slave status \G
mysql> create table test123(id int(4)); Query OK, 0 rows affected (0.01 sec) mysql> insert into test123 values(1); Query OK, 1 row affected (0.00 sec) mysql> insert into test123 values(2); Query OK, 1 row affected (0.00 sec) mysql> insert into test123 values(3); Query OK, 1 row affected (0.00 sec) mysql> insert into test123 values(4); Query OK, 1 row affected (0.00 sec)
mysql> drop table test123;
關于MySQL數據庫中怎么實現主備切換問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。