mysql replication master-slave configuration linux (binary log files)

Installation mysql, a primary two machines (192.168.131.153), from a (192.168.131.154)

Host Configuration

Modifying the master file to add /etc/my.cnf

  # server_id = 153 ### server the above mentioned id
  # log-bin = MySQL log-bin ### open files

  Note: in this position, not on the bottom

    

  service mysqld restart restart mysql

 

These two statements are viewing the master configuration is correct, 

SHOW VARIABLES LIKE 'server_id'; (server_id not configured by default to 0, the success of 153)

 

show master status; (see host status, file synchronization, synchronization position)

To an account from the authorization

GRANT REPLICATION SLAVE ON *.* to 'mysync'@'%' identified by 'lqm';

 

Slave Configuration

 my.cnf file

the server_id = 154 #
# log-bin bin-MySQL =
# = binlog_do_db which database synchronization User #


service mysqld restart # restart

 

Execute sql slave synchronization host

stop SLAVE

change master to master_host='192.168.131.153',master_user='mysync',master_password='lqm',master_log_file='mysql-bin.000002',master_log_pos=991;

start SLAVE

 

Modify the host, the slave will follow changed

 

Guess you like

Origin www.cnblogs.com/lqmblog/p/11328840.html