主从复制(整理)

//mysql8.0之前版本。设置主库
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

//mysql8.0以及之后版本。设置主库
create user 'root'@'%'identified by '123456';
grant all privileges on *.* to 'root'@'%' with grant option;

//mysql设置从库
change master to master_host='192.168.100.1',master_user='root',master_password='123456',master_log_file='mysql-bin.000016',master_log_pos=5555;

 
posted @ 2022-11-06 22:47  每日一小步  阅读(11)  评论(0编辑  收藏  举报