Mysql 5.6 Master-Slave synchronization

Source: Internet
Author: User


Mysql 5.6 Master-Slave synchronization (and 5.1 is different):


And 5.1 differ mainly in two places (both in the From section):

1, the designated Master section can not be written into the/etc/my.cnf, you have to hit the MySQL command

2. The start/stop slave command is: Start/stop/reset slave (5.1 is slave in front)



Master (as with 5.1):


# Mkdir/var/lib/mysql/logs

# Chown-r Mysql:mysql/var/lib/mysql/logs

# mysql-u root-p123456


> Grant replication Slave on * * to ' Ming ' @ ' 192.168.1.3 ' identified by ' 123456 ';

>flush privileges;

# vi/etc/my.cnf (under [mysqld])


Server-id = 1 (The database server has a unique Server-id, usually the master server is set to 1)

Log-bin=/var/lib/mysql/logs/log

Relay_log=/var/lib/mysql/logs/relaylog

read-only = 0 (master MySQL can read and write)

: Wq

# Service Mysqld Restart

# mysql-u root-p123456

> Show master Status;

Or

> Show master Status \g;



From:


# Mkdir/var/lib/mysql/logs

# Chown-r Mysql:mysql/var/lib/mysql/logs

# vi/etc/my.cnf (under [mysqld])

Server-id = 2 (formerly Server-id=1, of course, set to non-1 other numbers can also)

Log-bin=/var/lib/mysql/logs/log (specify MySQL binary log path)

Relay_log=/var/lib/mysql/logs/relaylog

Read-only=1 (read-only operation allowed)

# Service Mysqld Restart

# mysql-u root-p123456


> Change Master to master_host= ' 192.168.1.2 ', master_user= ' Ming ', master_password= ' 123456 ';


> Slave start;

> show slave status \g;

If the following two items are yes, the slave configuration succeeds.

Slave_io_running:yes

Slave_sql_running:yes


This article is from the "Linux" blog, so be sure to keep this source http://yangzhiming.blog.51cto.com/4849999/1660731

Mysql 5.6 Master-Slave synchronization

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.