MySQL Master-slave configuration

Source: Internet
Author: User

From the library can be many stations, we assume a master m, a from S.

Main M profile add:

Server-id=1

Bin-log=logbin

The name is random.

Remember to restart

From the S configuration file add:

server-id=2

The configuration file is complete

In the main m client execution:

>show Master status;

Record the file and location (file,position), for example: logbin.000001 120

In from the S client execution:

>change Master to master_host= ' master's host address ', master_user= ' have sync copy access account ', master_password= ' password ', master_log_file= ' Logbin.000001 ', master_log_pos=120;

Synchronous replication permissions refer to the following: REPLICATION SLAVE.

Authorization example SQL for user account (password for pwd) connected from localhost:

>grant replication Slave on * * to ' user ' @ ' localhost ' identified by ' PWD ';

>flush privileges;

Open from S:

>start slave;

View from S Status:

>show processlist;

Complete.

Master-Slave Backup is the instruction executed by the main m machine automatically in the execution from the S machine, so if M already has a library that s does not have, the operation you do on the library will cause synchronous replication to fail. Therefore, it is recommended to use a clean MySQL instance to master from backup.

Stop from backup from S: Stop slave; clean: reset slave;

MySQL Master-slave configuration

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.