0. Preparation
A. Install the database : the master-slave MySQL database (MySQL server) is installed:
Version, MySQL allows low version master with high version slave
Https://dev.mysql.com/doc/refman/5.7/en/replication-compatibility.html
Of course, the same version is the best.
B. Table synchronization and Data synchronization: data synchronization and fabric synchronization of tables in the primary database (master) from the Database (slave) (if only a specific table is replicated only for a specific table, then the row is synchronized for a particular form, then how to configure it)
Data synchronization and fabric synchronization can be done easily with a navicat class of tools
1. Configure master-Slave mode:
You can refer to the article of the Great God:
Itwork's Blog
original works, allow reprint, please be sure to use hyperlinks in the form of the original source of the article, author information and this statement. Otherwise, the legal liability will be investigated. http://369369.blog.51cto.com/319630/790921
2. Some small details:
How to find the configuration file:
Windows: For example 5.7, the configuration file location is: Programdata\mysql\mysql Server 5.7\my.ini
Ubuntu:vi/etc/mysql/my.cnf
How MySQL restarts:
Ubuntu:/etc/init.d/mysql Restart
Windows: You can find MySQL from the Task Manager service, or cmd: "net stop mysql57" "net start mysql57"
If you are synchronizing only a few table:
In the slave database configuration, using the replicate-do-table configuration, there are several table writes:
Replicate-do-table=db_name.table_name
Replicate-do-table=db_name.table_name
Remember to restart MySQL after you modify it
Please note:db_name and TABLE_NAME are both DB and table names for the slave database, do not use Master's name!!
(I haven't found any mistakes for a long time.) The two sides have been connected, but the modification monitoring of the table has been filtered out. )
If the name of the master database is not the same as the slave:
For example master called db123, Slave called db456.
In the slave database configuration, use the REPLICATE-REWRITE-DB configuration:
replicate-rewrite-db=db123->db456
Make a simple name rewrite just fine.
Remember to restart MySQL after you modify it.
If you are a VMware virtual machine as Slave:
Edit another configuration file for slave,
Vi/etc/mysql/mysql.conf.d/mysqld.cnf
Comment out the line "bind-address = 127.0.0.1"
How to debug:
A. Multi-view server Logs (if you are using MySQL Workbench, click Management, find the server Logs under the "Instance" column), it will prompt many warning and errors, according to the error search answer.
B. MySQL official teaching, step by step, some common instructions can find the problem:
Https://dev.mysql.com/doc/refman/5.7/en/replication-problems.html
3. Information reference:
This is the configuration entry manual for the MySQL configuration file:
Https://dev.mysql.com/doc/refman/5.7/en/replication-options-slave.html
This article is from the "10259463" blog, please be sure to keep this source http://10269463.blog.51cto.com/10259463/1932063
Mysql master-slave replication and some special settings to note