MySQL Master-slave replication

Source: Internet
Author: User

Planning:

Primary server: 192.168.1.254

From server: 192.168.1.215

System environment:

Operating system centos6.4_x64

MySQL mysql-server-5.1.73-3.el6_5.x86_64

First, configure the main service side

    1. Editing Profiles         vim /etc/my.cnf         [mysqld]         innodb _file_per_table=1        log_bin=master-bin         log_bin_index=master-bin.index         server-id=1        sync_binlog=1         2. Creating a user with permissions         mysql> grant replication  SLAVE ON *.* to  ' repluser ' @ ' 192.168.1.% '  IDENTIFIED BY  ' replpass ';         Query OK, 0 rows affected  (0.09  SEC)         mysql> FLUSH PRIVILEGES;         query OK, 0 rows affected  (0.10 SEC) 

Second, the configuration from the server

    1. Editing Profiles         vim /etc/my.cnf         [mysqld]         relay_ log=slave-log        relay_log_index=slave-log.index          innodb_file_per_table=1         relay-log=relay-log        relay-log=relay-log.index         server-id=11        read-only=1     2. Configuration parameters mysql> change master to master_host= ' 192.168.1.254 ', MASTER_USER = ' Repluser ', master_password= ' Replpass ', master_log_file= ' master-bin.000001 ',master_log_pos=339     mysql> SHOW SLAVE STATUS/G    Slave_IO_State:       &nbsP;                master_host:  192.168.1.254                       Master_User: repluser                       Master_Port:  3306                     Connect_Retry: 60                   Master_Log_File: master-bin.000001               Read_Master_Log_Pos: 339                    relay_log_file : slave-log.000001                     relay_log_pos: 4            relay_ master_log_file: master-bin.000001                  Slave_IO_Running: No                 Slave_SQL_Running: No                     3. Start Service      mysql> START SLAVE;    mysql> SHOW SLAVE STATUS\G;             Slave_IO_Running: Yes             slave_sql_running: yes

MySQL Master-slave replication

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.