MySQL Database Synchronization instance demonstration

Source: Internet
Author: User
The synchronization instance of the MySQL database is demonstrated. In this experiment, the primary and secondary synchronization configuration of the MySQL database (the best combination with PHP) is not required. If it is useless, I will not talk about it much, the actual configuration steps are as follows. MySQL (the best combination with PHP) in this test is 4.1.7-standard-log. Master Operating System

The synchronization instance of the MySQL database is demonstrated. In this experiment, the primary and secondary synchronization configuration of the MySQL database (the best combination with PHP) is not required. If it is useless, I will not talk about it much, the actual configuration steps are as follows. MySQL (the best combination with PHP) in this test is 4.1.7-standard-log. Master Operating System

The synchronization instance of the MySQL database is demonstrated. In this experiment, the primary and secondary synchronization configuration of the MySQL database (the best combination with PHP) is not required. If it is useless, I will not talk about it much, the actual configuration steps are as follows. MySQL (the best combination with PHP) in this test is 4.1.7-standard-log.

The master operating system is redhat 9.0 and the slave operating system is redhat 7.3.

1. modify my. cnf on the master end and add the configuration parameters:

 
 
  1. [MySQL (the best combination with PHP) d]
  2. Log-bin
  3. Server-id = 1

2. modify my. cnf on the slave side and add the configuration parameters:

 
 
  1. log-bin
  2. mastermaster-host=master
  3. master-user=rep
  4. master-password=rep
  5. master-port=3306
  6. server-id=2

The above parameters are the most basic configuration, so I will not explain them much. I will undo it to initialize the data.

1. Clear all binlogs on the master. If the existing binlogs are useful, back up them first. Then, pack all data files on the master, including ibdata files.

2. A similar method is used to clear all binlogs on the slave and copy the data file compressed package on the master to its own data file directory.

Start the master and add a rep user,

 
 
  1. " grant all privileges on *.* to rep@% identified by 'rep'; flush privileges; ".

Start slave and check whether the synchronization is successful.

Generally, the reason for the failure is that the binlog fails to be located after the slave connects to the master. Therefore, you need to set the binlogs of both parties to be consistent, and then stop slave; start slave.

The above content is an introduction to the synchronization instance of the MySQL database. I hope you will have some gains.

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.