Project

General

Profile

Bug #65

Updated by Daniel Curtis about 11 years ago

An unknown incident caused MySQL to fail starting up at boot time. This wiped out all of the data from every table and corrupted the @ibdata1@ file. The engine used on this version of MySQL is InnoDB. 

 h2. 1. Check to see if the service is running: 

 <pre> 
 sudo service mysql status 
 </pre> 

 h2. 2. Attempt to start MySQL 

 <pre> 
 sudo service mysql start 
 </pre> 

 The service fails to start. 

 h2. 3. Backup the corrupt @ib@ files 

 <pre> 
 sudo mkdir /var/lib/mysql/bak 
 cp /var/lib/mysql/ib* /var/lib/mysql/bak 
 </pre> 

 h2. 4. Start MySQL service with InnoDB recovery 

 <pre> 
 mysqld --defaults-file=/etc/mysql/my.cnf --innodb-force-recovery=6 
 </pre> 

 h2. 5. Dump the recovered MySQL databases to @backup.sql@ 

 <pre> 
 mysqldump -u root -p --all-databases > backup.sql 
 </pre> 


 h2. 6. Stop MySQL service with InnoDB recovery 

 <pre> 
 ps -aux | grep mysql 
 kill -s kill <PID#> 
 </pre> 

 h2. 7. Purge the corrupt @ib@ files. 

 *NOTE*: Remember to backup the corrupt @ib@ files first. If something goes wrong with the working corrupt files, there will be nothing to fall back to. 

 <pre> 
 sudo rm -rf /var/lib/mysql/ib* 
 </pre> 

 h2. 8. Start the normal MySQL 

 <pre> 
 sudo service mysql start 
 </pre> 

 h2. 9. Import recovered databases from @backup.sql@ 

 <pre> 
 sudo mysql -u root -p < backup.sql 
 </pre> 

Back