Wamp MySQL to create a master-slave database

Source: Internet
Author: User

It doesn't matter if you're wmap, Wamp is an integrated environment that just helps you create a Web server at once.
Here are some configurations for you.


First, log in to master server, modify My.ini, add the following content:

[Wampmysqld]
#数据库ID号, represented as master at 1, where master_id must be a positive integer value between 1 and 232–1;
Server-id = 1
#启用二进制日志;
Log-bin=mysql-bin
#需要同步的二进制数据库名;
Binlog-do-db=test
#不同步的二进制数据库名, if it is not set, it can be commented out;
Binlog-ignore-db=mysql
#设定生成的log文件名;
Log-bin= "E:/database/materlog"
#把更新的记录写到二进制文件中;
Log-slave-updates
#跳过错误, continue with replication;
Slave-skip-errors

Restart MySQL after configuration

Second, in the main library to establish slave replication to use the user;


Mysql>grant replication Slave on * * to [e-mail protected] identified by ' ******** ';

Back up the data from the test library that is configured in the main library to be synchronized to the library

IV. login Slave database server, modify My.ini;

[Wampmysqld]
#如果需要增加Slave库则, this ID is deferred;
Server-id = 2
Log-bin=mysql-bin
#主库host
Master-host = 192.168.1.3
#上面刚才建立的复制使用的用户
Master-user = Forslave
Master-password = ******
Master-port = 3306
#如果发现主服务器断线, the time difference between reconnection;
Master-connect-retry=60
#不需要备份的数据库;
Replicate-ignore-db=mysql
#需要备份的数据库
Replicate-do-db=test
Log-slave-update
Slave-skip-errors

After the configuration is complete, restart the MySQL from the library

V. Start the slave and see if the slave status is normal;


Mysql>slave start;
Mysql>show slave status\g;

You also need to take a look at the main library using commands


Mysql> Show master status;


Compare whether two libraries are the same wamp

Wamp MySQL to create a master-slave database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.