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

Analysis of the use of the MySQL database show processlist command

In actual project development, if we have a lot o...

Meta tags in simple terms

The META tag, commonly referred to as the tag, is...

MySQL account password modification method (summary)

Preface: In the daily use of the database, it is ...

WeChat applet realizes linkage menu

Recently, in order to realize the course design, ...

How to use css overflow: hidden (overflow hiding and clearing floats)

Overflow Hide It means hiding text or image infor...

Vue implements small form validation function

This article example shares the specific code of ...

In-depth understanding of the seven communication methods of Vue components

Table of contents 1. props/$emit Introduction Cod...

JavaScript Factory Pattern Explained

Table of contents Simple Factory Factory Method S...

Detailed steps to start the Django project with nginx+uwsgi

When we develop a web project with Django, the te...

Use Firebug tool to debug the page on iPad

How to debug a page on iPad? When using iOS 5, you...

jQuery implements form validation

Use jQuery to implement form validation, for your...

Implementation steps for installing FTP server in Ubuntu 14.04

Table of contents Install Software Management Ano...