Reset (Re-Sync) Mysql Master-Slave Replication
By Anuket Jain On 8 April 2015 In Database
Some times we face issue in MySQL replication and slave could not sync. The cause of this issue may have lots of reason. Following Steps help you to start Re-Sync Mysql.
Note:-When you Re-Sync MySQL Replication all of your bin-log files will be deleted, so if you want, you may take a backup of bin-log files first and then follow the instructions.
Step 1: Slave Server
First we need to stop slave from slave server using following command.
# mysql> STOP SLAVE;
Step 2: Master Server
# mysql> RESET MASTER; # mysql> FLUSH TABLES WITH READ LOCK;
# mysqldump -u username –p techoism > techoism.sql
# mysql> UNLOCK TABLES;
Step 3: Slave Server
# mysql -u root –p techoism < techoism.sql
# mysql> RESET SLAVE; # mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=1;
# mysql> START SLAVE;
# mysql> show slave status\G