MYSQL5.6.33 Master/Slave Database Synchronization installation and configuration (Master-Linux Slave-windows7 ),

Source: Internet
Author: User

MYSQL5.6.33 Master/Slave Database Synchronization installation and configuration (Master-Linux Slave-windows7 ),

1. installation environment

Here, we will also record how to uninstall the decompressed MySQL database on Windows 7. If you do not need to uninstall the database, ignore the next step. You can simply go to step 3.

Ii. Uninstall and decompress MySQL for Windows 7

1. Run cmd to enter the MySQL bin directory and run the mysqld-remove command to delete the MySQL service, as shown in figure


2. Delete the MySQL directory and related files, I store the location is D: \ mysql-5.6.3, that is, to delete this directory.

3. to delete the registry information, you only need to delete the following three items:

HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \ Services \ Eventlog \ Application \ MySQL

HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet002 \ Services \ Eventlog \ Application \ MySQL

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Eventlog \ Application \ MySQL

The unmount operation has been completed.

Iii. Install and decompress MySQL5.6 in Windows 7

1. decompress the MySQL compressed file to the location you want to store, I put it in D: mysql-5.6.3;

2. Rename the my-default.ini file in it to my. ini;

3. modify the content of the my. ini file as follows;

4. Configure the environment variables and append D: \ mysql-5.6.3 \ bin to the system variable Path;

5. Use cmd to enter the MySQL bin directory and install the MySQL service, as shown in figure

6. Prompt that the MySQL service is started after the installation is successful, and then log on to MySQL to verify whether the installation is successful, as shown in


After the installation is successful, the root user does not have a password by default. here, because I have set a password, you need to enter the password. If there is no password, press enter to enter MySQL.

Iv. Database Configuration

1. Master Configuration

(1) in Linux, the MySQL configuration file is/etc/my.cnfComplete Configuration:


Log-bin = mysql-bin # Open the log (the host needs to be opened). This mysql-bin can also be customized. You can add a path here, for example: /home/www/mysql_bin_log/mysql-bin

Server-id = 1Used to identify a unique database. Set this parameter to 1. You must set this parameter to another value when setting the slave database.

(2) Restart MySQL:

service mysqld restart

(3). log on to MySQL and grant the slave database permission account to allow users to read logs from the master database, as shown in figure

(4) Restart MySQL and log on to MySQL to display the master database information, as shown in figure

Here, File and Position are used when configuring Salve. Binlog_Do_DB indicates the database to be synchronized, and Binlog_Ignore_DB indicates the Ignore database. These are all specified during configuration, the configuration of the master database is basically complete.

2. Slave Configuration

(1). Modify the slave database configuration file, for example;


Binlog-ignore-db = information_schema database to be ignored

Replicate-do-db = test: database to be synchronized

(2) restart the database and execute the following command;

Specify the Master information here. master_log_file is the File option when configuring the Master. master_log_pos is the Position option for configuring the Master.

(3). Passshow slave status;View configuration information;


You can see that the configuration is successful.

5. Test

Add a data entry to the master database table, as shown in figure

Query from the database query table for any newly added records, as shown in figure

The test is successful. Data has been automatically synchronized from the master database to the slave database;

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Related Article

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.