From: Daevid Vincent Date: May 20 2009 7:11pm Subject: mySQL slave IO Running and SQL Running List-Archive: http://lists.mysql.com/mysql/217620 Message-Id: <786F1914BC7E4409924A0BB229577468@mascorp.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0311_01C9D944.26EFC0E0" ------=_NextPart_000_0311_01C9D944.26EFC0E0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit We have a master / slave setup and as you know, one bad query can ruin your whole day. Or if you accidentally write to the slave when you meant to write to the master, or any number of other things that break the fragility of a replication setup. The magic incantation to get them synched again seems to be to login to the slave and do this (over and over again until the Slave_IO_Running and Slave_SQL_Running both say "Yes"): mysql> stop slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; start slave; show slave status\G Is there a way to automate this a little bit. Maybe some bash script that uses "mysql -e" and parses for those two strings? Is this dangerous to do? Is there a setting to have the slave do this already? In every case I've ever seen, it's always some SQL that got out of whack like this: Last_Error: Error 'Duplicate key name 'id_operator'' on query. Default database: 'core'. Query: 'ALTER TABLE `user_has_notification` ADD INDEX `id_operator` (`id_operator`)' ------=_NextPart_000_0311_01C9D944.26EFC0E0--