Fixing a broken replication in MySQL
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…
Bookmarks…
I can’t add your post to Digg. How I do this?…
Trackback by MOBY — August 10, 2007 @ 9:58 am
Hi Moby,
I just installed an plugin for you to do so. Please let me know if it works.
Mac
Comment by mac — August 21, 2007 @ 5:14 pm