On the Master server dump a backup of the database you want to resync
[cc]mysqldump –skip-lock-tables –single-transaction –flush-logs –hex-blob –master-data=2 -q <
Move compress backup to Slave server
[cc]scp ~/dump.sql.gz <
On the Slave server decompress the backup
[cc]gunzip ~/dump.sql.gz[/cc]
Get the Master Log Name and Position from the dump, Make a note of the MASTER_LOG_FILE & MASTER_LOG_POS values
[cc]head dump.sql -n80 | grep “MASTER_LOG_POS”[/cc]
Stop mySQL/MariaDB
[cc]service mysql stop[/cc]
Put the following option in your my.conf config file (most probably under /etc/my.conf) under the [mysqld] section to disable the slave from auto starting
[cc]skip-slave-start[/cc]
Start mySQL/MariaDB
[cc]service mysql start[/cc]
Log into mySQL and check the Slave is off
[cc]mysql -u root -p
SHOW SLAVE STATUS \G;
exit;[/cc]
Load backup into Slave server
[cc]mysql -u root -p <
Stop mySQL/MariaDB
[cc]service mysql stop[/cc]
Remove the following option in your my.conf config file (most probably under /etc/my.conf) under the [mysqld] section to enable the slave for auto starting
[cc]skip-slave-start[/cc]
Start mySQL/MariaDB
[cc]service mysql start[/cc]
Log into mySQL and check the Slave is On. Take Note of the Seconds_Behind_Master . This will decrease as the Slave server catches up with the Master server.
[cc]mysql -u root -p
SHOW SLAVE STATUS \G;
exit;[/cc]