mysql5.5 Master-Slave synchronization under Windows

Source: Internet
Author: User

Pre-conditions:

A host (as the primary server)

Environment: win7,mysql5.5 ip:172.17.42.82

b Host (as Slave server)

Environment: win7,mysql5.5 ip:172.17.42.156

Primary server configuration:

1. Create a sync dedicated account in MySQL database a slave

Command: GRANT REPLICATION slave,reload,super on * * to [e-mail protected] ' 172.17.42.156 ' identified by ' 517na.com ';

Note: 172.17.42.156 is the password for the account 517na.com from the server's IP slave

2. Modify the A server configuration to open the Mysql/my.ini file, add the following under [Mysqld]:

server-id=10 Log-bin=mysql-bin

Where: Server-id: ID value for primary Server A (recommendation 1-32, preferably after 10)

Log-bin: Binary Change Day value

3. Restart a server (from now on, it will record the client-related database changes in the binary change log)

Command:

net stop MySQL

net start MySQL

From the server configuration:

1. Modify the B server configuration to open the Mysql/my.ini file, add the following under [Mysqld]:

server-id=11

Log-bin=mysql-bin

Relay-log=relay-bin

Relay-log-index=relay-bin-index

Replicate-do-db=songyustock

Note: replicate-do-db: Databases that need to be synchronized

2. Restart the B server

3. Log in to MySQL and enter the following command:

Stop slave;

Master_host= ' 172.17.42.82 ', master_user= ' slave ', master_password= ' 517na.com ';

Start slave;

4. Check that the settings are correct

Command: show slave status\g;

The main is to see if the following two items are yes:

Slave_io_running:yes

Slave_sql_running:yes

Note:

1. View sever_id's command: Show Varias like ' server_id ';

2. Reference article: http://blog.csdn.net/g2321514568/article/details/12441049

Common errors in configuration:

1.ERROR (HY000): The server is not configured as slave; Fix in config file or with change MASTER to

Solution: http://bg.artuion.com/window_linux/122.html

2.MySQL Synchronous Failure: Two solutions for "Slave_sql_running:no"

Solution: Http://blog.chinaunix.net/uid-21505614-id-289477.html http://kerry.blog.51cto.com/172631/277414

3.linux under Configuration Master-slave reference article: http://www.cnblogs.com/cchun/p/3712637.html

mysql5.5 Master-Slave synchronization under Windows

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.