*#开启主从复制,主库的配置*
*log-bin="C:/taotao/3380/logs/mysql-bin"*
*#指定同步的数据库,如果不指定则同步全部数据库*
*binlog-do-db=taotao*
#授权用户slave01使用123456密码登录mysql
grantreplication slave on *.* to 'slave01'@'127.0.0.1' identified by '123456';
flushprivileges;
重新启动主mysql服务,执行SQL语句查询状态:
*SHOW MASTER STATUS
执行SQL:
CHANGE MASTER TO
master_host = '127.0.0.1',
master_port = 3380,*
master_user = 'slave01',
master_password = '123456',
master_log_file = 'mysql-bin.000003',
master_log_pos = 120
*#启动slave同步*
START SLAVE;
*#查看同步状态*
SHOW SLAVE STATUS;
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |