MySQL Master/Slave setting in Win7 is the Master

Source: Internet
Author: User
I read the Master-Slave settings of MySQL after work in the company. The general meaning and process have been understood, but I have never practiced it. I have time to practice it today. I have two Win7 servers on hand. Let's use them together !! First set the relationship A to Master, B to Slave. (The Mysql on both machines is 5.0, but different) set A's my. iniserver-id1log-

I read the Master-Slave settings of MySQL after work in the company. The general meaning and process have been understood, but I have never practiced it. I have time to practice it today. I have two Win7 servers on hand. Let's use them together !! First, set relationship A to Master, and B to Slave. (Mysql on both machines is 5.0, but different) set my. ini server-id = 1log-of-

I read the Master-Slave settings of MySQL after work in the company. The general meaning and process have been understood, but I have never practiced it. I have time to practice it today. I have two Win7 servers on hand. Let's use them together !!

First, set the relationship A to Master, and B to Slave. (Mysql on both machines is 5.0 +, but different)

Set my. ini of

server-id = 1log-bin=mysql-binbinlog_do_db=test1binlog_ignore_db=mysqlinnodb_flush_log_at_trx_commit=1sync_binlog=1binlog_checksum=none

Note:

Server-id = 1 # machine ID
Log-bin = mysql-bin # enable binary log
Binlog_do_db = test1 # database to be synchronized
Binlog_ignore_db = mysql # ignore mysql Databases
Sync_binlog = 1 # refresh and write binary logs in time

Binlog_checksum = none # different versions and A is greater than 5.6, so you need to set

Create the test1 database and tab table on Table

Create an slave user on the Master

grant all privileges on *.* to slave@'%' identified by 'slave';

This is a Super User. Haha

A: The basic configuration of the Master is complete.

Start configuring B-Slave

Set my. ini of B

log-bin=mysql-binbinlog_do_db=test1binlog_ignore_db=mysql
Same as above

Create A test1 database and A tab table identical to B.

Now that the configuration is complete, we will start to find the synchronization point for the binary log to be synchronized.

Enter

mysql>show master status\G;*************************** 1. row ***************************             File: mysql-bin.000053         Position: 606     Binlog_Do_DB: test1 Binlog_Ignore_DB: mysqlExecuted_Gtid_Set:
That is, the binary log of the test1 database is 606 at the mysql-bin.000053 location

Input on B

Change master to master_host = 'a's ip', master_user = 'slave ', master_password = 'slave', master_log_file = 'mysql-bin.000053 ', master_log_pos = 606;
mysql> show slave status\G;*************************** 1. row ***************************               Slave_IO_State: Waiting for master to send event                  Master_Host: 10.209.78.13                  Master_User: slave                  Master_Port: 3306                Connect_Retry: 30              Master_Log_File: mysql-bin.000053          Read_Master_Log_Pos: 333               Relay_Log_File: Lee-PC-relay-bin.000002                Relay_Log_Pos: 492        Relay_Master_Log_File: mysql-bin.000053             Slave_IO_Running: Yes            Slave_SQL_Running: Yes              Replicate_Do_DB: test1          Replicate_Ignore_DB: mysql           Replicate_Do_Table:

If you see
Slave_IO_Running: YesSlave_SQL_Running: Yes
It means you have succeeded.

Test it now.

Insert A piece of data on A to see if B has uploaded it.

This tutorial is complete.

NOTE: If I show slave status \ G on B, connecting to master may occur because

  1. Incorrect password
  2. Port 3306 of a cannot be accessed
  3. Wait until all machine B cannot connect to machine.

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.