MYSQL5.6.33 database master/slave (Master/Slave) synchronization installation and configuration details (Master-Linux Slave-windows7)

MYSQL5.6.33 database master/slave (Master/Slave) synchronization installation and configuration details (Master-Linux Slave-windows7)

1. Installation environment

Here is also a record of how to uninstall the unzipped version of MySQL5.6 database on Windows7. If you do not need to uninstall, please ignore the next step and go directly to the third step.

2. Uninstall the unzipped version of MySQL 5.6 on Windows 7

1. Use cmd to enter the bin directory of MySQL, execute the mysqld -remove command, and delete the MySQL service, as shown below


2. Delete the MySQL directory and related files. I stored them in D:\mysql-5.6.3, so just delete this directory.

3. To delete the registry information, just 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 uninstallation is now complete.

3. Install the unzipped version of MySQL 5.6 on Windows 7

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

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

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

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

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

6. After the installation is successful, start the MySQL service, and then log in to MySQL to verify whether the installation is successful, as shown below


After the installation is successful, the root user has no password by default. Here I have set a password before, so I need to enter the password. If there is no password, just press Enter. As shown in the figure, you have entered MySQL

4. Database related configuration

1.Master Configuration

(1) The MySQL configuration file in Linux environment is /etc/my.cnf . The complete configuration is as follows


log-bin = mysql-bin #Open the log (the host needs to open it). This mysql-bin can also be customized. You can also add the path here, such as: /home/www/mysql_bin_log/mysql-bin

server-id =1 is used to identify a unique database. It is set to 1 here. You need to set it to other values ​​when setting up the slave database.

(2) Restart MySQL:

service mysqld restart

(3) Log in to MySQL and grant the slave database permission account, allowing the user to read logs on the master database, as shown below

(4). Restart MySQL, log in to MySQL, and display the main database information, as shown below

The File and Position here are used when configuring Salve. Binlog_Do_DB indicates the database to be synchronized, and Binlog_Ignore_DB indicates the database to be ignored. These are specified during configuration. At this point, the main database configuration is basically completed.

2.Slave Configuration

(1). Modify the slave library configuration file as shown below;


binlog-ignore-db=information_schema Database to ignore

replicate-do-db=test The 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, and master_log_pos is the Position option when configuring the Master. They need to correspond here.

(3). Check the configuration information through show slave status; ;


You can see that the configuration has been successful.

5. Testing

Add a piece of data in the main database table, as shown below

To query the table from the library to see if there are any newly added records, as shown below

The test was successful, and the data has been automatically synchronized from the master database to the slave database;

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • MySQL5.6 master-slave replication synchronization detailed configuration (picture and text)
  • MySQL5.6 database master-slave synchronization installation and configuration details (Master/Slave)
  • MySQL5.6 Replication master-slave replication (read-write separation) configuration complete version
  • MySQL5.6 master-slave replication (mysql data synchronization configuration)
  • MySQL 5.6.14 master-slave replication (also known as MySQL AB replication) environment configuration method
  • Practical record of MySQL 5.6 master-slave error reporting

<<:  ReactJs Basics Tutorial - Essential Edition

>>:  Introduction to generating Kubernetes certificates using OpenSSL

Recommend

Native js to realize the upload picture control

This article example shares the specific code of ...

MySQL 8.0 New Features: Hash Join

The MySQL development team officially released th...

Docker installation and deployment of Net Core implementation process analysis

1. Docker installation and settings #Install Cent...

Conflict resolution when marquee and flash coexist in a page

The main symptom of the conflict is that the FLASH...

The difference between mysql outer join and inner join query

The syntax for an outer join is as follows: SELEC...

VMware Workstation 12 Pro Linux installation tutorial

This article records the VMware Workstation 12 Pr...

An article to help you thoroughly understand position calculation in js

Table of contents introduction scroll Element.scr...

A brief analysis of adding listener events when value changes in html input

The effect to be achieved In many cases, we will ...

Building command line applications with JavaScript

Table of contents 1. Install node 2. Install Comm...

Tutorial on installing PHP on centos via yum

First, let me introduce how to install PHP on Cen...

Docker View Process, Memory, and Cup Consumption

Docker view process, memory, cup consumption Star...

Ten useful and simple MySQL functions

function 0. Display current time Command: select ...

Echarts implements switching different X-axes in one graph (example code)

Rendering If you want to achieve the effect shown...

Vue implements form validation function

This article mainly describes how to implement fo...