MySQL Master-Slave synchronization

Source: Internet
Author: User
Tags mysql version mysql view

1. Prepare two virtual machines a 192.168.174.132 "master" B 192.168.174.133 "from" 2.MySQL version >5.03. Common commands Show Master status;show slave status;show Procudesslist \g; You can see how many clients are currently linked to this library 4. Configuration 4.1. Make sure/etc/my.cnf belongs to the current MySQL, you can copy the auto-generated to/ETC/MY.CNF cp/usr/shara/mysql/my-medium.cnf/etc/ MY.CNF 4.2. Main Library configuration my.cnf server-id=10101 log-bin=mysql-bin binlog-ignore-db=mysql,test innodb_flush_log_at_trx_commit= 1 sync_binlog=1 log_slave-updates Show Master Status View current main library state to add a user from the library GRANT REPLICATION Slave on * * to ' repl ' @ ' 2.2.2.% ' Identified by ' Testpass '; Restart MySQL 4.3 from library configuration my.cnf server-id=20101 Replicate-do-db=demo//data block to be synchronized replicate-do-table=user//table to be synchronized "can add more than one" Master-info-file=master.info Relay-log=relay-relay-bin Relay-log-index=relay-relay-bin.index relay-log-info= Relay-relay-log.info restart MySQL to enter MySQL settings Master library information may need to be closed first slave [stop slave] Change master to master_host= ' 1.1.1.1 ',//main library IP mast Er_user= ' repl ',//the user name assigned in the main library master_password= ' Testpass ',//Assigned password master_log_file= ' mysql-bin.000003 ',//main library Show File master_log_pos=107 in master status; //main Library show master status Open Slave "start slave" restart MySQL view from library info Show slave ensure middle Slave_io_running=yes slave_sql_running=yes out Wrong can view the MySQL error log location by viewing the MySQL bug log position show variables like ' log_error '; If the synchronization fails, you can go through show slave status; View the SQL statement of the error execution. Start slave is then required because an error will automatically stop slave

MySQL master-slave synchronization

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.