Archive for November, 2006

Fixing a broken replication in MySQL

Friday, November 10th, 2006

The easy way…

Log on to the slave and do a “load data from master” :

host:/home/mac# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 131 to server version: 4.0.24_Debian-10sarge2-log
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql> load data from master;
ERROR 1189: Net error reading from master

This means that there is most likely a corruption in your logfiles…

What to do ?

* On the direct parent :

mysqldump -a --add-drop-table -e -x -p --master-data
-u root -p -B DB_to_Replicate > /tmp/master.sql

* Copy the file to the slave
* On the slave :

mysql> stop slave;
mysql> . /tmp/master.sql
mysql> start slave;
mysql> show slave status;

Wait a bit and check that the replication catches on…

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]