MySQL master-slave configuration, mysql master-slave Configuration

Source: Internet
Author: User

MySQL master-slave configuration, mysql master-slave Configuration
1. Configure the master database. Assume that the master database IP address is 192.168.1.1. modify my. cnf and add the configuration server-id = 1 under [mysqld ].
Log-bin = syslog ################################### # Enable Logging
Binlog-do-db = cmstop ############################### execute Replication database
Binlog-ignore-db = mysql ############################# copying without execution database
Binlog-ignore-db = test ############################### do not execute copied Database
Binlog-ignore-db = information_schema ################### save and modify the database that does not execute replication, restart MySQL, log on to the master server, and authorize replication. user grant replication slave on *. * to't _ user' @ '192. 168.1.2 'identified by '20140901' with grant option;

View the show master status;

Mysql> show master status;
+ --------------- + ---------- + -------------- + ------------------------------- +
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+ --------------- + ---------- + -------------- + ------------------------------- +
| Binlog.11205 | 639 | cmstop | mysql, test, information_schema |
+ --------------- + ---------- + -------------- + ------------------------------- +
1 row in set (0.00 sec) Write down file, position value 2. From Database Configuration assume that the master database IP address is: 192.168.1.2 modify my. cnf adds the configuration server-id = 2replicate-do-db = cmstop under [mysqld] (because MySQL does not support master-host and master-user parameters, it is not in my. cnf add these configurations) log on to the slave database and configure the host and other information change master to master_host = '2017. 168.1.1 ', master_user = 't_user', master_password = '000000', master_log_file = 'syslog. 000005 ', master_log_pos = 639; start slave; view the show slave status \ G status; check whether an error is reported. If the replication fails, you can change the permission to (grant select, insert, update, delete, replication slave on *. * to't _ user' @ '192. 168.1.2 'identified by '20140901' with grant option ;)
Mysql Master/Slave Database

After the master and slave nodes are configured, the master database inserts data into the binary log and sends it to the slave database. The slave database receives binary logs and writes them to the relay log. The slave database reads and inserts data from the relay log.

Mysql Master/Slave Database

After the master and slave nodes are configured, the master database inserts data into the binary log and sends it to the slave database. The slave database receives binary logs and writes them to the relay log. The slave database reads and inserts data from the relay log.

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.