Error Recurrence:
use rm-f ib* to delete data files and redo log files.
At this MySQL process also exists, MySQL can also be used normally.
File Recovery:
1 : Find mysqld the process number.
# NETSTAT-NTPL | grep mysqld TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 12147/mysqld
2: Use the process number to find the following file.
# LL/PROC/12147/FD | Egrep ' Ib_|ibdata ' lrwx------1 root root, 09:23/mydata/ib_logfile1 (deleted) lrwx------1 root root June 09:23 4-/mydata/ibdata1 (deleted) lrwx------1 root root June 09:23 9-/mydata/ib_logfile0 (Del eted)
3: Add a lock so that the database does not have write operations.
Sql> flush tables with read lock;
4: Enter the following command to have the dirty page brush into the disk as soon as possible.
sql> set global innodb_max_dirty_pages_pct=0;
5: Check the InnoDB status information, verify that the dirty page has been brushed into the disk, compared to the following values:
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M00/83/CE/wKiom1d8xOaD0CiyAAMcq5xJP7Q778.jpg "style=" float: none; "title=" 1.jpg "alt=" Wkiom1d8xoad0ciyaamcq5xjp7q778.jpg "/>
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/83/CD/wKioL1d8xOnCp__oAAPycmf52lE458.jpg "style=" float: none; "title=" 2.jpg "alt=" Wkiol1d8xoncp__oaapycmf52le458.jpg "/>
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/83/CE/wKiom1d8xOvga9oyAANGMuf7h74073.jpg "style=" float: none; "title=" 3.jpg "alt=" Wkiom1d8xovga9oyaangmuf7h74073.jpg "/>
6: After the confirmation is completed, the recovery operation can be done, and the previously recorded deleted files are copied to the original directory.
# CD/PROC/12147/FD # CP 10/mydata/ib_logfile1# CP 4/mydata/ibdata1# CP 9/MYDATA/IB_LOGFILE0
7: Restart mysqld service is available.
This article from the "Play God Clown" blog, reproduced please contact the author!
MySQL mistakenly delete innodb data file recovery