MySQL Master-slave replication

Source: Internet
Author: User
Tags flush

First make sure that there are more than two MySQL servers to view the server IP address Windows under the Command window input ipconfig linux input ifconfig determine the address of two servers and ping each other to see if you can ping through ( May need to shut down Windows and Linux firewalls)

down to make sure that the server is acting as the primary server edit the MySQL profile on the primary server under Windows My.ini Linux for my.cnfOpen the binary log under [mysqld] on the primary server Log_bin set the value of server_id server_id only to ensure that the integer is not repeated on the line is generally configured for the IP address restart the login master server MySQL

Add a user with copy permissions grant replication slave on * * to ' root ' @ ' 192.168.80.% ' identified by ' 123456 '; flush privileges under flush;

Enter show master status and then enter
Do not close the window

Open from server settings server_id here do not need to turn on binary log setup well after restarting MySQL service log on from server MySQL

Settings from there to start copying
1Change Master toMaster_host='192.168.93.1', Master_port=3306, Master_user='Root', Master_password='123456', Master_log_file='desktop-16im3fa-bin.000176', Master_log_pos=405;
The values for Msater_log_file and master_log_pos here are the values in the master state of the primary server initiating replication
1 start slave
(If you modify the replication source, you need stop slave to stop replication first) to detect from the server state on the Execute command from the server, show slave status confirmation
1 show slave status;

See if IO SQL two threads are double YES if you are not looking at the following error Last_error tips for debugging

If it's double yes then the configuration is successful. Let's test it. Create a database in the master server MySQL to add a bit of data to see if there are any from the server

MySQL Master-slave replication

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.