Did you just run an UPDATE against your 10 million row users
table without a WHERE clause? Did you know that in MySQL
5.5 that sometimes you can recover from a bad UPDATE statement?
This is possible if you are running in binlog_format=ROW !
Imagine this scenario:
CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB;
INSERT INTO `t1` (`c2`) VALUES ('michael'), ('peter'), ('aamina');
We run an accidental UPDATE statement that changes a row:
UPDATE `t1` SET `c2` = 'tom' WHERE `c1` = 2;
If we examine this UPDATE using the Binary Logging format of
STATEMENT the entry would look like:
# at 464
#121019 16:10:42 server id 1 end_log_pos 532 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1350677442/*!*/;
BEGIN
/*!*/;
# at 532
#121019 16:10:42 server id 1 end_log_pos 638 Query thread_id=1 exec_time=0 error_code=0
SET …
[Read more]