Resync MySQl Database

At the master:

  1. RESET MASTER;  
  2. FLUSH TABLES WITH READ LOCK;  
  3. SHOW MASTER STATUS;  
And copy the values of the result of the last command somewhere.

Wihtout closing the connection to the client (because it would release the read lock) issue the command to get a dump of the master.

  1. mysqldump -uroot -p --all-databases > /a/path/mysqldump.sql  
Now you can release the lock, even if the dump hasn't end. To do it perform the following command in the mysql client.
  1. UNLOCK TABLES;  
Now copy the dump file to the slave using scp or your preferred tool.

At the slave

Open a connection to mysql and type
  1. STOP SLAVE;  
Load master's data dump with this console command.
  1. mysql -uroot -p < mysqldump.sql  
Sync slave and master logs
  1. RESET SLAVE;  
  2. CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=98;  
Where the values of the above fields are the ones you copied before.

Finally type
  1. START SLAVE;  
And to check that everything is working again, if you type
  1. SHOW SLAVE STATUS;  
You should see
  1. Slave_IO_Running: Yes  
  2. Slave_SQL_Running: Yes