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