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
I suddenly thought of this method when I was writi...
HTTP Status Codes The status code is composed of ...
First run the docker container Run the command as...
Table of contents Tutorial Series 1. Install Mari...
This article shares the specific code for impleme...
The information on Baidu is so diverse that it...
1. Check the character set of the database The ch...
To achieve this effect, you must first know a pro...
Table of contents 1. Unzip 2. Create a data folde...
1. Meaning of partition table A partition table d...
Table of contents 1. Introduction 2. Configuratio...
I would like to share with you the graphic tutori...
Recently, I need to frequently use iframe to draw ...
Table of contents 1. Panorama II. Background 1. R...
Use the Linux chmod command to control who can ac...