MySQL crash on startup

前端 未结 2 1545
后悔当初
后悔当初 2020-12-12 01:22

I\'m developing on my laptop with wamp and mysql is running fine from weeks. Today after 60 seconds after boot mysql crashes I and find the following error inside the log:

相关标签:
2条回答
  • 2020-12-12 02:17

    It was probably a corruption of the InnoDB data. I added

    innodb_force_recovery = 2
    

    to my.ini, restarted the DB and I was able to dump all the data and recover it.

    Be aware of using this, read the documentation before: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html

    0 讨论(0)
  • 2020-12-12 02:25

    I had similar problem on a CentOS VPS and Stefano Giacone's answer is basically what I did so it worked after hours of researching and a lot of stress...

    Well the steps were:

    1) Find my.cnf file (mine was located in /etc/my.cnf) and add the line:

    innodb_force_recovery = X

    replacing X with a integer from 1 to 6, starting from 1 and then incrementing if MySQL won't start. Setting to 4, 5 or 6 can delete your data so be carefull and read http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html before.

    2) Restart MySQL service. Only SELECT will run and that's normal at this point.

    3) Dump all your databases/schemas with mysqldump one by one, do not compress the dumps because you'd have to uncompress them later anyway in 6).

    4) Move (or delete!) only the bd's directories inside /var/lib/mysql, preserving the individual files in the root.

    5) Stop MySQL and then uncomment the line added in 1). Start MySQL.

    6) Recover all bd's dumped in 3).

    That worked for me, good luck!

    0 讨论(0)
提交回复
热议问题