Search code examples
mysqlinnodbmamp

Error Starting MySQL after Crash


I was merrily installing wordpress with MAMP pro when my Mac crashed. Now I cannot start MySql. Most stuff I read online tells me to throw some terminal commands at it, trying to kill the process.

killall -9 mysqld

But terminal report "No matching processes belonging to you were found"

So I have had a look in the log and can see this from the time of the first restart attempt after the crash

    150506 21:11:33 mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql
150506 21:11:33 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
150506 21:11:33 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/ is case insensitive
150506 21:11:33 [Note] Plugin 'FEDERATED' is disabled.
150506 21:11:33 InnoDB: The InnoDB memory heap is disabled
150506 21:11:33 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150506 21:11:33 InnoDB: Compressed tables use zlib 1.2.3
150506 21:11:33 InnoDB: Initializing buffer pool, size = 128.0M
150506 21:11:33 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
150506 21:11:33  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
150506 21:11:33  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
150506 21:11:33  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
150506 21:11:34  InnoDB: Waiting for the background threads to start
150506 21:11:35 InnoDB: 5.5.42 started; log sequence number 0
150506 21:11:35 [Note] Event Scheduler: Loaded 0 events
150506 21:11:35 [Note] /Applications/MAMP/Library/bin/mysqld: ready for connections.
Version: '5.5.42'  socket: '/Applications/MAMP/tmp/mysql/mysql.sock'  port: 0  Source distribution
150506 21:16:44 [Note] /Applications/MAMP/Library/bin/mysqld: Normal shutdown

So Table Space size error.. I am very much a front end guy and have no idea where to begin with this...??

Help please, I really can't afford to loose the last week of work.

Thanks you


Solution

  • As you pointed out InnoDB tablespace is corrupt, so InnoDB fails to start.

    InnoDB can tolerate some errors if you start it with option innodb_force_recovery. Try values from 1 to 6 until MySQL starts.

    If you're lucky and MySQL starts with innodb_force_recovery then dump all tables into an sql file with mysqldump and re-create MySQL database from scratch. I.e. move existing files to some safe place, start mysql_install_db, change file permissions and start MySQL. Then load the database back.

    If you're less lucky and MySQL doesn't start with innodb_force_recovery=6 then check how to Recover Corrupt MySQL Database .

    And to avoid this experience in future use XtraBackup for Mac OS to take backups.