MySQL won’t start

MySQL

110926 12:09:41  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
InnoDB: Last MySQL binlog file position 0 3329, file name /var/lib/mysql/mysql-bin.004279
110926 12:09:42  InnoDB: Started; log sequence number 46 4210009908
110926 12:09:42 [Note] Recovering after a crash using /var/lib/mysql/mysql-bin
110926 12:09:42 [Note] Starting crash recovery...
110926 12:09:42 [Note] Crash recovery finished.
110926 12:09:42 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.0.45-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution

from web admin:

#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)

Every time I access the DB, it crashes as far as I can tell

Best Answer

MySQL was failing to read parts of the database due to a failing HDD.

mysqldump would fail because of this as well.

I ended up writing a python script to pull out all the readable parts of the Innodb database.

In summary:

  1. img'd hard drive with dd (http://www.thegeekstuff.com/2010/10/dd-command-examples/)
  2. backed up database via mysqldump (with python script to skip unreadables)
  3. imported into new system