MySQL master-slave separation under CentOS

Source: Internet
Author: User

1, respectively open the host and slave my.cnf command to set

Vim/etc/my.cnf

Under [mysqld], fill in the numbers yourself, but not repeat them.

Log-bin

Server-id=?

2, in the host to operate, into the MySQL

Host gives slave permission: Grant replication slave, replication client on * * to ' rep ' @ ' slave IP ' identified by ' password '; Rep can set its own

Refresh permissions: Flush privileges;

Then turn off MySQL and refresh the systemctl restart Mysqld

3. Re-enter MySQL and enter show master status; Get for example mysqld-bin.000001 409 of these 2 numbers

4. Enter MySQL from the machine

Change Master to master_host= ' host IP ', master_user= ' rep ', Master_password = ' password ', master_log_file= ' master1-bin.000009 ', master_log_pos=154;

Rep is just a host set of master1-bin.000009 and 154 just got from the host, all need to be replaced from the host to get the number

5, stop Slave;

6, start slave;

7, show slave status\g; show waiting for Master to send event succeeds

MySQL master-slave separation under CentOS

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.