码迷,mamicode.com
首页 > 数据库 > 详细

Windows下MySQL的主从热备(自动同步)配置

时间:2015-04-02 16:36:51      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:windows mysql

本配置方法适用于5.1之后的版本,个人在5.5上配置成功(5.1之前版本请参考另外的配置说明)

 

环境说明:

Master:192.168.1.200

Slave:192.168.1.210

 

MySQL 的 Master 配置:

配置my.ini:

 

[mysqld]

# The TCP/IP Port the MySQL Server will listen on

port=3306

server-id=200

log-bin=mysql-bin

relay-log=relay-bin

relay-log-index=relay-bin-index



 

*配置好后,重启Master 的 MySQL服务!!!

 

//--------------------------------------------------

MySQL 的 Slave 配置:

配置my.ini:

 

[mysqld]

# The TCP/IP Port the MySQL Server will listen on

port=3306

server-id = 210

replicate-do-db = test

 

*配置好后,重启Slave 的 MySQL服务!!!

//--------------------------------------------------

 

登录Slave,然后执行下面命令:

 

mysql> stop slave;

mysql> change master to master_host=‘192.168.1.200‘,master_user=‘root‘,master_password=‘123456‘;

mysql> start slave;

mysql> show slave status\G;

 

查看这两项是否为YES,yes为正常。

Slave_IO_Running: Yes

Slave_SQL_Running: Yes


本文出自 “清视的藏宝阁” 博客,请务必保留此出处http://heyhongwu.blog.51cto.com/9921842/1627696

Windows下MySQL的主从热备(自动同步)配置

标签:windows mysql

原文地址:http://heyhongwu.blog.51cto.com/9921842/1627696

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!