Project

General

Profile

Bug #65

MySQL Fails to Start on Ubuntu at Boot Time

Added by Daniel Curtis over 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Immediate
Assignee:
Target version:
-
Start date:
02/06/2013
Due date:
% Done:

100%

Spent time:

Description

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.

1. Check to see if the service is running:

sudo service mysql status

2. Attempt to start MySQL

sudo service mysql start

The service fails to start.

3. Backup the corrupt ib files

sudo mkdir /var/lib/mysql/bak
cp /var/lib/mysql/ib* /var/lib/mysql/bak

4. Start MySQL service with InnoDB recovery

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

5. Dump the recovered MySQL databases to backup.sql

mysqldump -u root -p --all-databases > backup.sql

6. Stop MySQL service with InnoDB recovery

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

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.

sudo rm -rf /var/lib/mysql/ib*

8. Start the normal MySQL

sudo service mysql start

9. Import recovered databases from backup.sql

sudo mysql -u root -p < backup.sql

History

#1 Updated by Daniel Curtis over 7 years ago

  • Description updated (diff)

#2 Updated by Daniel Curtis over 7 years ago

  • Assignee set to Daniel Curtis
  • % Done changed from 0 to 100

I have still yet to find the cause of this database corruption. But I have managed to save the databases, and create backups of the databases. I should really look at setting up some sort of backup scheme on the Collaboration Server.

#3 Updated by Daniel Curtis over 7 years ago

  • Status changed from New to Closed

#4 Updated by Daniel Curtis over 7 years ago

  • Project changed from 10 to Website Hosting

#5 Updated by Daniel Curtis about 7 years ago

  • Private changed from Yes to No

Also available in: Atom PDF