MySQL implementation of master-Slave synchronization in Window environment

Source: Internet
Author: User

The same computer is configured mysql5.5 two instances, respectively, on 3310 and 33,112 ports. Set 3310 for the main library and 3311 for the slave library.

The final effect is as follows:

3310 Main Library:

Grant ReplicationSlave,reload,super on *.*  toSlave@192.168.1. theIdentified by '123456';
--added under [mysqld] in the My.ini fileServer-Id= 1Replicate-Do-Db=Test1

3311 from the library:

 --  My.ini file [mysqld] add  server- ID =  2  replicate  - do- db=  test1relay  -  Log  =  relay- binrelay  - log  - index  =  relay- Bin - index  
Stop slave;

--"Method One"
Change Master toMaster_host='192.168.1.110', Master_port=3310, Master_user='slave', Master_password='123456';--"Method Two" if you specify position synchronization, use (the following two parameters through the main Library command "show master status;"view):
Change Master toMaster_host='192.168.1.110', Master_port=3310, Master_user='slave', Master_password='123456',
Master_log_file='mysql-bin.000001', Master_log_pos=107;

Start slave;

At this point, the configuration is complete by command:

show slave status\g;

To see if the synchronization is successful, the key metrics are:

Slave_IO_Running:YesSlave_SQL_Running:Yes

Note:

-- View server_id:  like ' server_id ';
-- View host status on the primary server, file and positionshow Master State;

The default configuration of the root account in MySQL does not have a password, modified by the following ways:

- - penter Password: (direct carriage return here)
-- Change Password to 123456 set Password=password ('123456'); -- Refresh Permissions privileges;

Attached my.ini configuration file Download:

My.ini Download

Reference:

Https://www.cnblogs.com/puchengjie/p/5220676.html

Master-Slave synchronization failure Solution:

Slave_sql_running:no

http://blog.51cto.com/kerry/277414

Http://blog.chinaunix.net/uid-21505614-id-289477.html

Linux under Configuration Master-slave reference:

Http://blog.chinaunix.net/uid-21505614-id-289477.html

MySQL implementation of master-Slave synchronization in Window environment

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.