Mysql – Rebuilding corrupt slave by copying thesql folder

MySQLmysql-replicationreplication

Rebuilding an existing slave from a master using cold-copying of /var/lib/mysql, would this be the proper process/order? Anything missing?

  1. master mysql> SHOW MASTER STATUS\G (take notes)
  2. slave mysql> STOP SLAVE;
  3. Shut down master and slave mysqld
  4. Move existing slave:/var/lib/mysql out of the way
  5. Copy master:/var/lib/mysql to slave:/var/lib/mysql
  6. Start master mysqld
  7. Start slave mysqld
  8. slave
    mysql> CHANGE MASTER TO MASTER_HOST='masterserver',
    -> MASTER_USER='replicationusername',
    -> MASTER_PASSWORD='replcationpassword',
    -> MASTER_LOG_FILE='logfilefromshowmasterstatus',
    -> MASTER_LOG_POS=positionfromshowmasterstatus;
  9. slave mysql> start slave;

Best Answer

I'd suggest referring to a following link:

MySQL MySQL 5.1 Reference Manual 16.1.1 How to Set Up Replication