replicationMysql Replication is used to get a mirror copy of master server to slave. All changes made in server is updated on slave. This can be achieved by the following steps. one thing to be notify is the master and salvemay contain the same version of mysql.

  changes in master

edit /etc/my.cnf
  [mysqld]
  log-bin = mysql-bin
  server-id = 1
  restart the mysql service

enter the following commands in mysql

grant all on *.* to user@slaveip identified by ‘userpassword’ with grant option;
     grant replication slave on *.* to ‘username’@masterip identified by ‘userpassword’;
     show master status;

    changes in slave

vi /etc/my.cnf
[mysqld]
  log-bin = mysql-bin
  server-id = 2
  restart the mysql service 

enter the following commands in mysql

grant all on *.* to username@localhost identified by ‘userpassword’;
     change master to master_host=’server ip’;
     change master to master_user=’username’;         
     change master to master_password=’userpassword’;               
     change master to master_log_file=’mysql-bin’;     
     change master to master_log_pos=561;  (by command show master status;  in master )        

to update data from master by using the command 

load data from master;