Win MYSQL master-slave Database Synchronization settings for Data Synchronization updates

Source: Internet
Author: User

The system database needs to be backed up in real time. However, the webservice data backup method previously considered has a great impact on the program running efficiency. After checking the data, mysql can set the master-slave server to back up data. All data backup tasks are handed over to the mysql server, which has little impact on the running of the group buying system and can achieve real-time backup. The following are some steps for configuring the mysql Master/Slave server (test environment: the master server is win2003, mysql version is 5.1.51, the slave server is win7, and mysql version is 5.1.51 ).

1. Add a backup user to the master server. Set the global permissions to RELOAD, SUPER, and replication slave. All permissions of the database to be backed up are assigned to the change user, and the user can remotely log on to the master server.

2. Add the following content under [mysqld] In my. ini of the master server:

Server-id = 1 # master server id

Log-bin = D: mysqllogmysql. log # backup

Binlog-do-db = tg # back up the database

3. Restart the master server.

4. Set the slave server and add it under [mysqld] In my. ini of the slave server:

Server-id = 2 # It must be different from the master server id

Master-host = ***. *** # master server ip Address

Log-bin = D: mysqllogmysql. log

Master-user = slave # New user Name on the master server

Master-password = 123 # password

Master-port = 3306 # master server port

Master-connect-retry = 60 # synchronization interval: 60 seconds

5. Restart the slave server mysql. Run show master status on the MASTER server mysql to record the File and Position values. Start the slave server mysql and run the following command:

Change master to master_host = ***.***.***.***;

Change master to master_user = 'slave ';

Change master to master_password = 123;

Change master to master_log_file = mysql.000001 # File value recorded just now

Change master to master_log_pos = 38392; # position value recorded just now,

Run start slave; show slave status. If the status is successful, a data record related to the master server is returned,

Return to the master server and run show processlist to check the connection status of the slave server. The Master/Slave server settings have been completed.

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.