我正在运行Ubuntu 12.04 LTS虚拟机。上周,VM意外停止,现在mysql无法在VM上启动。这两个事件可能是相关的,它们可能不相关。
当我尝试连接时:
$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
然后:
$ sudo service mysql start
start: Job failed to start
和
$ dmesg
[ 1838.218400] type=1400 audit(1374633238.253:50): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=18473 comm="apparmor_parser"
[ 1838.358656] init: mysql main process (18477) terminated with status 1
[ 1838.358695] init: mysql main process ended, respawning
[ 1839.269303] init: mysql post-start process (18478) terminated with status 1
和
$ service mysql status
mysql stop/waiting
我认为这意味着mysql在启动时崩溃:
$ sudo mysqld start
130723 21:51:24 InnoDB: Assertion failure in thread 3064211200 in file fut0lst.ic line 83
InnoDB: Failing assertion: addr.page == FIL_NULL || addr.boffset >= FIL_PAGE_DATA
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
02:51:24 UTC - mysqld got signal 6 ;
根据手册 ,我去了数据目录(/ var / lib / mysql)并运行了这个:
myisamchk --silent --force */*.MYI
然后:
$ sudo mysqld
...
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
...
我的数据库损坏了吗?我该怎么做才能恢复?重新安装mysql?不那么激烈的东西?丢失数据库我很好,我只想要一个工作系统。
似乎innodb表是腐败的。
—
John Naegle
看来我的数据库已损坏并阻止mysql启动。根据手册,我将其添加到/etc/mysql/my.cnf:[mysqld] innodb_force_recovery = 6.当我重新启动服务器时,它启动时没有崩溃。
—
John Naegle
好的,很高兴知道。
—
CS.
我的数据库似乎还没有用 - 但至少我认为我知道这个问题。我将重新安装mysql并查看问题是否已修复。
—
John Naegle
尝试使用--purge选项删除mysql,然后从头开始重新安装。
—
l1zard