What are the advantages of MySQL master-slave in windows?

Source: Internet
Author: User

The following article mainly introduces the MySQL master-slave in windows operating system. The reason why MySQL master-slave can be widely used in a short time is as follows, this is also because of its unique functions. The following articles describe the functions of MySQL master-slave in windows.

MySQL replication settings

 
 
  1. Set up MySQL replication and control slave thread  

MySQL master-slave backup

Recommendation circle: Database circle

For more information, we recommend that you install MySQL

1. install two MySQL instances first, that is, copy a MySQL instance (MySQL5.1 and MySQL5.2)

2. Modify the port number and installation address (my. ini). Here we do not use the default port 3306 for main tests.

Xml Code

 
 
  1. MySQL5.1   
  2. [client]   
  3. port=3307   
  4. [MySQLd]   
  5. port=3307   
  6. basedir="E:/MySQL5.1/"   
  7. datadir="E:/MySQL5.1/Data/"   
  8. MySQL5.2   
  9. [client]   
  10. port=3308   
  11. [MySQLd]   
  12. port=3308   
  13. basedir="E:/MySQL5.2/"   
  14. datadir="E:/MySQL5.2/Data/"   
  15. MySQL5.1  
  16. [client]  
  17. port=3307 
  18. [MySQLd]  
  19. port=3307 
  20. basedir="E:/MySQL5.1/" 
  21. datadir="E:/MySQL5.1/Data/" 
  22. MySQL5.2  
  23. [client]  
  24. port=3308 
  25. [MySQLd]  
  26. port=3308 
  27. basedir="E:/MySQL5.2/" 
  28. datadir="E:/MySQL5.2/Data/" 

3. Create a backup account in the database of the Master (MySQL master-slave). The command is as follows:

SQL code

 
 
  1. GRANT REPLICATION SLAVE ON *.* TO 'slave'@'localhost' IDENTIFIED BY '123456';   
  2. GRANT REPLICATION SLAVE ON *.* TO 'slave'@'localhost' IDENTIFIED BY '123456';  
  3.  

4. Modify Master to MySQL5.1 as follows (my. ini ):

Xml Code

[MySQLd]

# Master start

# Log output addresses are mainly used for synchronization

Log-bin = E: \ MySQL5.1 \ Data \ log-bin.log

# Synchronize Databases

Binlog-do-db = cnb

# The host id cannot be the same as the slave id

Server-id = 1

# Master end

[MySQLd]

# Master start

# Log output addresses are mainly used for synchronization

Log-bin = E: \ MySQL5.1 \ Data \ log-bin.log

# Synchronize Databases

Binlog-do-db = cnb

# The host id cannot be the same as the slave id

Server-id = 1

# Master end

The above content is an introduction to MySQL master-slave in windows. 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.