MySQL master-slave master-slave synchronous replication configuration for read-write separation preparation

Source: Internet
Author: User
Tags unique id

1, for convenience, I installed two MySQL instance under one windows, the port is 3306, 3307 respectively

Open the My.ini or my-default.ini file configuration Basedir datadir and port, default 3306. Configured as follows

Master Node

 [ mysqld  ]  log-bin  =mysql-bin//  must  ]   = D:\developer\mysql-5.6.24 -win32datadir  = D:\developer\mysql-5.6.24- win32\data# Port  = ... server_id  = =10//[  must    server unique ID, default is 1, Generally take IP last paragraph sql_mode  =no_engine_substitution,strict_trans_tables 

From the node

[mysqld] log-bin=mysql-bin   #[ not required ]== = 3307  Server-id=11       #[ must ] server unique ID, default is 1, generally take IP last paragraph sql_mode

To install the MySQL service, the command is as follows:

D:\developer\mysql-slave\bin\mysqld.exe install Mysql-slave--defaults-file= "d:\developer\mysql-slave\ My-default.ini "

Master MySQL server creates replication permissions for the user, and then restarts

Grant Replication  on *. *  to ' Repl '@ '%' by'qwert';

Show master status; The database is then not manipulated.

Slave server connection Master, the command is as follows:

Stop slave;
Change Master toMaster_host='127.0.0.1', Master_port=3306, Master_user='Repl', Master_password='Qwert', Master_log_file='mysql-bin.000001', Master_log_pos= 2388;
Start slave;
show slave status;

Problems that arise:

1, show master status; Show as empty the binary log is not turned on log-bin = ...

2, show slave status; Show Slave I/o: Error connecting to master ' [email protected]:3306 '-retry-time:60

Because the MySQL user of the master server has user = empty, delete from Mysql.user where user= ' and then reboot.

Resources:

1. Install multiple MySQL under Windows

2. mysql Master-slave replication

3. mysql Replication configuration http://www.cnblogs.com/northhurricane/p/3919889.html

4. Master-Slave standby (auto-sync) configuration for MySQL under Windows

MySQL master-slave master-slave synchronous replication configuration for read-write separation preparation

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.