I had mysql running on my VPS. Today it crashed for no good reason!
I tried service mysql start
, it gave me start: Job failed to start
.
First thing I did was to backup /var/lib/mysql
which contained folders corresponding to my databases and these other files:
debian-5.5.flag
ibdata1
ib_logfile0
ib_logfile1
mysql_upgrade_info
I removed /etc/mysql
and did sudo apt-get purge mysql-server mysql-common
and then installed everything again, the result was the same: start: Job failed to start
.
I went to /var/lib/mysql/
and deleted ib*
files. I could start mysql then, but some of the tables were problematic: I could see their names in PhpMyAdmin, but when tried to run queries, mysql errored out that the table doesn't exist.
I assume ibdata1
is corrupted! I put innodb_force_recovery = 0
and tried it upto innodb_force_recovery = 6
, none of them worked and I got the same error when I tried to start mysql.
I still have the whole /var/lib/mysql
backup.
Any ideas why this happened and how I can recover the data and start mysql again?
Best Answer
What You make right - it is backup all files from /var/lib/mysql
all other steps - wrong
Your current error (in PHPMyAdmin with phantom tables) - because You have Your database folder with .frm files for table structure, and empty (new) ibdata.
What You can do now - revert all back (restore files in it original place) Then You can: - check error log file, for error message - start change innodb_force_recovery from 1 to 6