The main record is the process of configuring master-slave replication and issues. Reference link: http://blog.sina.com.cn/s/blog_4c197d4201017qjs.html.
First, MySQL
Local Windows environment, download the free install version, extract two copies to local and modify the port usage number, respectively, 3306, 3307.
Second, the configuration
1.master
(1) Start MySQL service, command line login Mysql:mysql-u root-p
(2) Authorization: Grant REPLICATION SLAVE on * * to ' repl ' @ ' 127.0.0.1 ' identified by ' slaveuser ';
(3) Querying the state of the main library: show master status;
2.slave
(1) Open the MySQL installation directory of My.ini, modify Server-id = 1 for Server-id = 2, note that this ID must be unique
(2) Start MySQL service, command line login Mysql:mysql-u root-p
(3) Execute the synchronization statement:
to Master_host='127.0.0.1', master_port=3306, Master_user='repl', Master_password=' slaveuser ',
1master_log_file=' mysql-bin.000031', Master_log_pos=1385 ;
Each of these parameters is set or queried in the previous step 1.
(4) Start slave process: start slave;
After completing the above steps, you can view the log files of the slave.
OK, this configuration is successful.
Some of the issues that you may encounter:
1. Do not perform replication to view the slave error log:
(1) Check if master correctly authorizes REPL users
Main Library command line execution:
There's nothing wrong with that.
(2) Log in to master from the slave command line:
Incorrect password settings, re-executing the synchronization statement on slave and ensuring that the password is correct:
Shutdown slave process information: stop slave;
Perform the synchronization statement in step 2, change ...
Start slave process: start slave;
2. The configuration does not have to be successful at one time, sometimes several times back and forth, when the slave synchronization process is initiated, the command line may report:
ERROR 1198 (HY000): This operation cannot is performed with a running slave; run STOP slave firSt
At this point, the shutdown must be performed first: stop slave;
MySQL configuration master-slave replication