MySQLdump to reset Slave server from Master

Just a quick entry here. I keep forgetting how to reset a mysql slave server from the master, without disrupting the operations on the master server. Something silly that doesn’t stick in my head, so I am putting here for future use:

If you have Server A with the master, and Server B with the slave, and you need to reset the slave if it gets lost, simply do this:

Login to the Server A and issue this command:

mysqldump --master-data --all-databases newdbs.sql 

Then scp or ftp the newdbs.sql file to Server B.

Login to Server B, stop http and turn off the slave (slave stop;), load in the new database SQL file you brought over and restart the mysql slave (slave start;) and http:

/etc/init.d/httpd stop
/etc/init.d/httpd start 

To be sure everything is working as it should, you can go into mysql and ‘show slave status;’