--赋权所有IP均可以登录
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
--创建用户
create user repl;
--切换数据库为mysql
use mysql;
--修改密码
set password for repl=password('repl');
update user set password=password("repl") where user='repl';
--刷新权限
flush privileges;
--赋权限REPLICATION SLAVE权限
grant replication slave on *.* to 'repl'@'%' identified by 'repl';
--查看master状态
show master status;
--连接Master
change master to master_host='192.168.0.104', //Master 服务器Ip
master_port=3306,
master_user='repl',
master_password='mysql',
master_log_file='master-bin.000001',//Master服务器产生的日志
master_log_pos=0;
--启动Slave
start slave;
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
--创建用户
create user repl;
--切换数据库为mysql
use mysql;
--修改密码
set password for repl=password('repl');
update user set password=password("repl") where user='repl';
--刷新权限
flush privileges;
--赋权限REPLICATION SLAVE权限
grant replication slave on *.* to 'repl'@'%' identified by 'repl';
--查看master状态
show master status;
--连接Master
change master to master_host='192.168.0.104', //Master 服务器Ip
master_port=3306,
master_user='repl',
master_password='mysql',
master_log_file='master-bin.000001',//Master服务器产生的日志
master_log_pos=0;
--启动Slave
start slave;