MySQL master-slave replication allows data from one database (the master database) to be replicated to one or more databases (the slave databases). Master-slave replication process: 1. Any modification on the master server will be saved in the binary log through its own I/O tread (I/O thread). The environment is as follows: 1. Master database configuration 1. Create a new test database named testdb. 2. Open my.ini and add configuration # Master-slave replication server-id=1 # Set server-id log-bin=mysql-bin #Open binary file #Synchronize the database, and do not synchronize other databases (choose one of binlog-ignore-db below) binlog_do_db=testdb #Do not synchronize the database, synchronize everything else #binlog-ignore-db = information_schema #binlog-ignore-db = MySQL 3. Restart MySQL service 4. Create a user account for synchronization (1) Open a cmd window as an administrator, run mysql -uroot -p, enter the password (if it is blank, press Enter), and log in.
5. Check the Master status and record the binary file name and location
The binary file is mysql-bin.000005 and the position is 154 2. Configure from database 1. Create a new test database named testdb. 2. Verify whether the synchronization account can log in. Open Navicat for MySQL, create a new link, fill in IP 192.168.1.11, username MySlave, password 123456, and click "Connection Test" to verify whether it can connect. 3. Open my.ini and add configuration
4. Restart MySQL service 5. Use cmd command line to log in to MySQL database and execute the following command for manual synchronization
6. Start the salve synchronization process
7. Check slave status Execute command: show slave status\G; When Slave_IO_Running: Yes and Slave_SQL_Running: Yes, it indicates that the two threads have been started and the master-slave replication configuration is successful. 8. Test by creating a new table in the master database and refreshing the slave database to see the table. Remark: Before performing database master-slave replication, if there are tables and data in the master database, this data will not be synchronized and needs to be manually exported and imported into the slave database. The above is the detailed content of the configuration method of MySQL master-slave replication under Windows. For more information about MySQL master-slave replication, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: A complete guide to CSS style attributes css() and width() in jQuery
>>: How to configure the maximum number of files that can be opened by each Nginx process
Environment: init_worker_by_lua, set_by_lua, rewr...
Explain the whole process of CLion from scratch. ...
Several problems were discovered during the use o...
Common points: The DIV tag and SPAN tag treat som...
You can save this logo locally as a .rar file and...
background In order to support Docker containeriz...
This article mainly introduces how to implement a...
A set of projects for training react+ts Although ...
1. Log in to MySQL database mysql -u root -p View...
The so-called three-column adaptive layout means ...
The Docker container that has been running shows ...
Rendering pipeline with external css files In the...
Using Technology itext.jar: Convert byte file inp...
The Linux stream editor is a useful way to run sc...
Table of contents Scene Setting Game Resources Tu...