1. Resolve all SQL for all ring databases according to Binlog[email protected]]$ mysqlbinlog--no-defaults--database=ring--start-datetime= "2005-04-20 9:55:00"-- stop-datetim= "2009-04-08 08:05:00"/u01/mysql/log/mysql-bin.000005 >/u01/mysql/log/mysql_restore5.sql [email protected]]$ ls-l/u01/mysql/log/mysql_restore5.sql-rw-r--r--1 MySQL dba 407 APR 8 15:33/u01/mysql/log/mysql_restore5.sql --start-datetime=datetime from which point to start parsing--stop-datetim=datetime from which point to stop parsing--database=ring Specifies which database needs to be parsed and extracts only the SQL statements of a database--If you have multiple binlog, you need to parse multiple times, and you need to parse all the Binlog 2. Re-executing in the database[email protected]]$ Mysql-u root </u01/mysql/log/mysql_restore5.sqlERROR 1062 (23000) at line 2559580:duplicate entry 175754263-140 for key 1--primary key conflict during recovery, import failed 3. Delete the recovered data and restore it again[email protected]]$ mysql-u rootWelcome to the MySQL Monitor. Commands End With; or G.Your MySQL Connection ID is 7647Server version:5.0.67-log Source distributionType Help, or H for help. Type c to clear the buffer. [email protected] (none) 02:55:41>drop database ring;Query OK, 8 rows affected (0.04 sec) [[email protected]]$ mysql-u root-f </u01/mysql/log/mysql_restore5.sql-f parameter: Ignore error continueERROR 1062 (23000) at line 2559580:duplicate entry 175754263-140 for key 1ERROR 1062 (23000) at line 2564671:duplicate Entry 138 for key 1ERROR 1062 (23000) at line 2566216:duplicate entry 139 for key 1ERROR 1062 (23000) at line 2566224:duplicate entry + for key 1ERROR 1062 (23000) at line 2566232:duplicate Entry 141 for key 1ERROR 1062 (23000) at line 2566240:duplicate entry 142 for key 1ERROR 1062 (23000) at line 2648410:duplicate entry 143 for key 1ERROR 1062 (23000) at line 2648418:duplicate Entry 144 for key 1ERROR 1062 (23000) at line 2648581:duplicate entry 145 for key 1ERROR 1062 (23000) at line 2648589:duplicate entry 146 for key 1ERROR 1062 (23000) at line 2648597:duplicate entry 147 for key 1ERROR 1062 (23000) at line 2648605:duplicate entry 148 for key 1ERROR 1062 (23000) at line 2649279:duplicate entry 149 for key 1ERROR 1062 (23000) at line 2649287:duplicate entry-Key 1ERROR 1062 (23000) at line 2649295:duplicate entry 151 for key 1ERROR 1062 (23000) at line 2649303:duplicate entry-Key 1ERROR 1062 (23000) at line 2649311:duplicate entry 153 for key 1ERROR 1062 (23000) at line 2649319:duplicate entry 154 for key 1ERROR 1062 (23000) at line 2649327:duplicate entry 155 for key 1ERROR 1062 (23000) at line 2649335:duplicate entry 156 for key 1 Recovery is successful, some data conflicts need to be developed to deal with themselves.
MySQL uses Binlog to recover the database