MySql Replication Failure on primary secondary We have experienced replication failure between primary - secondary databases.

I have tried various scenarios to get replication to work again, which included deleting secondary database and restoring it from primary backup. However, replication still fails.

Would it be best to follow steps:

On Slave

mysql&gt; STOP SLAVE;


On Master

mysql&gt; RESET MASTER;
mysql&gt; FLUSH TABLES WITH READ LOCK;
mysqldump -u root -p mydb &gt; mydb-dump.sql
mysql&gt; UNLOCK TABLES;


On Slave

mysql -u root -p mydb &lt; mydb-dump.sql
mysql&gt; RESET SLAVE;
mysql&gt; CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=1;
mysql&gt; START SLAVE;
mysql&gt; show slave status\G


Is it safe to execute 

mysql&gt; RESET MASTER;
mysql&gt; RESET SLAVE;


as those commands deletes the binary log files. Or would it be better to use

mysql&gt; PURGE BINARY LOGS


Any thoughts would be greatly appreciated.

Cheers,
Roland
In the master server, you don't need to issue either RESET MASTER nor PURGE BINARY LOGS to extract a DB copy... when you need to extract a master copy to create a slave, just do it with the current binary log file and position.

Since you will need the current binary log file and position to start replication on the slave, just include the --master-data (more info) option to mysqldump which automatically appends the CHANGE MASTER TO statement required on the slave to start the replication process.
(Just open the mydb-dump.sql file after backup is completed and copy the "CHANGE MASTER TO" info.

In slave is perfectly safe to use RESET SLAVE after a backup restoration to start the replication.