Mysql crashed and won't start up

Solution 1:


InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: about forcing recovery.

Check the suggested webpage:

Basically, try to start the MySQL server in a recovery mode and make a backup of your crashed tables.

Edit your /etc/my.cnf and add:

 innodb_force_recovery = 1 see if you can get into your database and get your data / find the corrupted table.

Usually, when this happens it's a re-build (at least of a corrupted table or two).


  1. Stop mysqld (service mysql stop).
  2. Backup /var/lib/mysql/ib*
  3. Add the following line into /etc/my.cnf:

    innodb_force_recovery = 1

    (they suggest 4, but its best to start with 1 and increment if it won't start)

  4. Restart mysqld (service mysql start).

  5. Dump all tables: mysqldump -A > dump.sql
  6. Drop all databases which need recovery.
  7. Stop mysqld (service mysql stop).
  8. Remove /var/lib/mysql/ib*
  9. Comment out innodb_force_recovery in /etc/my.cnf
  10. Restart mysqld. Look at mysql error log. By default it should be /var/lib/mysql/server/ to see how it creates new ib* files.
  11. Restore databases from the dump: mysql < dump.sql

Solution 2:

I was facing this same error while using mysql:5.7 docker image. Main mistake was trying to create root user which exists by default. More information:

As given in the above link, solution was to NOT set MYSQL_USER and MYSQL_PASSWORD in the environment variables while starting the docker image.