MySQL Master-slave replication

Source: Internet
Author: User
Tags mysql version

The MySQL version used here is 5.6.23 and is configured with a new MySQL master-slave copy (no data existed before)

1. Configure Master

VI My.cnflog-bin=mysql-binserver-id=1innodb_flush_log_at_trx_commit=1sync_binlog=1service mysqld Restart

2. Configure slave

VI My.cnfserver-id=2service mysqld Restart

3. Create a user on Master for master-slave replication

mysql> CREATE USER ' repl ' @ '%.mydomain.com ' identified by ' Slavepass ';mysql> GRANT REPLICATION SLAVE on * * to ' REPL ' @ '%.mydomain.com ';

4. Record the master log name and location

Mysql> FLUSH TABLES with READ lock;mysql > SHOW MASTER STATUS; Reopen a session to view the log name and location exit the first session

5. Configure Slave

Mysql> change MASTER to-, master_host= ' master_host_name ', master_user= ' replication_user_name ', -master_password= ' Replication_password ', master_log_file= ' recorded_log_file_name ', M Aster_log_pos=recorded_log_position;


This article is from "My youth I am the Master" blog, please be sure to keep this source http://qikangwei.blog.51cto.com/2282397/1616943

MySQL Master-slave replication

Related Article

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.