MySQL Master-slave configuration

Source: Internet
Author: User

First, the primary database configuration assumes that the primary database IP address is: 192.168.1.1 Modify my.cnf Add configuration under [Mysqld] server-id=1
Log-bin=syslog ##################################### Open Log
Binlog-do-db=cmstop ############################### performing a replicated database
Binlog-ignore-db=mysql ############################# do not perform replicated databases
Binlog-ignore-db=test ############################### do not perform replicated databases
Binlog-ignore-db=information_schema ################### do not perform a replicated database save modify restart MySQL login master server Licensing replication user grant replication Slave on * . * to ' t_user ' @ ' 192.168.1.2 ' identified by ' 123456 ' with GRANT option;

View status show Master status;

Mysql> Show master status;
+---------------+----------+--------------+-------------------------------+
| File | Position | binlog_do_db | binlog_ignore_db |
+---------------+----------+--------------+-------------------------------+
|  binlog.000005 | 639 | Cmstop | Mysql,test,information_schema |
+---------------+----------+--------------+-------------------------------+
1 row in Set (0.00 sec)   Note file,position value Two, from the database configuration assume that the primary database IP address is: 192.168.1.2 Modify my.cnf Add configuration under [Mysqld] server-id= 2replicate-do-db=cmstop (because MySQL already does not support master-host,master-user similar parameters so do not add these configurations in my.cnf) log in from the database configuration host and other information change master to Master_host= ' 192.168.1.1 ', master_user= ' t_user ', master_password= ' 123456 ', master_log_file= ' syslog.000005 ', master _log_pos=639;start slave; View status  show slave status\g; see if there is an error if replication does not succeed the modifiable permission is (Grant Select,insert,update,delete, Replication Slave on * * to ' t_user ' @ ' 192.168.1.2 ' identified by ' 123456 ' with grant option;)     

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.