MySQL主从配置
本文最后更新于 2023-11-28,文章内容可能已经过时。
主数据库
CREATE USER 'slave'@'%' IDENTIFIED BY 'Password.123';
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'slave'@'%';
show master status;---position 和LogFileName 很重要
ALTER USER 'slave'@'%' IDENTIFIED WITH mysql_native_password BY 'Password.123';
从数据库
change master to master_host='220.167.187.41', master_user='slave', master_password='Password.123', master_port=316, master_log_file='mysql-bin.000001', master_log_pos= 446, master_connect_retry=30;
show slave status;
start slave;
stop slave;
master_log_pos---Position
master_log_file='mysql-bin.000001-=-file
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 程序员小航
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果