Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Synchronous updating of MYSQL Master-Slave Database under Win system

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "Win system MYSQL master-slave database synchronization settings to achieve data synchronization update", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "Win system MYSQL master-slave database synchronization settings to achieve data synchronization update" bar!

The system needs real-time backup, but the method of webservice backup data considered before has a great impact on the efficiency of the program. After consulting the data, it is found that the master-slave server can be set up to achieve the purpose of data backup. All the tasks of data backup are handed over to the mysql server, which has little impact on the program operation of the group purchase system, and can achieve the effect of real-time backup. Here are some steps for setting up the mysql master and slave server (test environment: the master server is win2003,mysql version 5.1.51; the slave server is win7, and the mysql version is 5.1.51).

1. Add a new user for backup on the master server, and the global permissions are set to RELOAD, SUPER, REPLICATION SLAVE. All permissions of the database to be backed up are assigned to the changed user, and the user can log on to the primary server remotely.

2. Add under "mysqld" in the my.ini of the master server:

Server-id=1 # Master server id

Log-bin=D:mysqllogmysql.log # backup

Binlog-do-db=tg # backup database

Restart the master server.

4. Set the slave server to add under "mysqld" in the my.ini of the slave server:

Server-id=2 # must be inconsistent with the id of the primary server

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

Log-bin=D:mysqllogmysql.log

Master-user=slave # New user name on the primary server

Master-password=123 # password

Master-port=3306 # master server port

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

5. Restart the slave server mysql. Run SHOW MASTER STATUS on the primary server mysql to record the values of the File and Position fields. Start mysql from the slave server and run the 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 # the file value just recorded

The position value just recorded by change master to master_log_pos=38392;#

Then run start slave;show slave status, and if successful, you can return a piece of data related to the master server

This is to go back to the master server and run show processlist to see the connection status of the slave server. To this master-slave server, the settings are complete.

Thank you for your reading, the above is the "Win system MYSQL master-slave database synchronization settings to achieve data synchronization update" content, after the study of this article, I believe you on the Win system MYSQL master-slave database synchronization settings to achieve data synchronization update this problem has a deeper understanding, the specific use of the need for practice to verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report