Mysql – Rebuild thesql slave from scratch

MySQLmysql-replicationmysql5

I'm having a master/slave mysql setup. This night I had some problems with the master. I needed to recreate all databases again because they were corrupt.

Now I stopped my mysql slave but want to start it again and rebuild everything from scratch. Is there a way to do this? Without locking the master…

I also think the binlog file should be reset. So everything is clean again.

Any ideas?

Best Answer

if you use innodb engine on the master - just use mysqldump with --skip-lock-tables, --single-transaction and --master-data=2 switches.

if your slave is only logically corrupted - try pt-table-sync with lock=0 option