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