即使在全新安装后,也无法让 mysql 工作/启动

即使在全新安装后,也无法让 mysql 工作/启动

我现在完全不知所措,虽然我不是高级用户,但我熟悉 Ubuntu,因此尝试借助某些论坛主题的帮助来研究一些事情。

问题: 今天,我的本地笔记本电脑上的 mysql 突然停止工作。我也无法启动该服务

$ sudo mysql start
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111

因此,经过大量搜索并检查文件权限(如其他帖子所建议的那样)后,我决定够了,并决定完全重新安装 mysql。这也不起作用。所以我找到了这个帖子来进行彻底清除:“无法生成 mysql 主进程:无法执行:没有此文件或目录”

再次失败,我发现很多其他帖子要么提供了对我不起作用的解决方案,要么根本没有解决方案。我不确定下一步该尝试什么,也不知道这是否是其他人遇到的常见问题。任何关于我可以运行的测试的建议都将不胜感激,因为我真的需要让 mysql 恢复并再次工作。

我重新安装 mysql 时遇到的当前错误是:

Setting up mysql-client-5.5 (5.5.31-0ubuntu0.13.04.1) ...
Setting up mysql-server-5.5 (5.5.31-0ubuntu0.13.04.1) ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin ...
No apport report written because MaxReports has already been reached
                                                                ldconfig deferred processing now taking place
Errors were encountered while processing:
 mysql-server-5.5
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up mysql-server-5.5 (5.5.31-0ubuntu0.13.04.1) ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 mysql-server-5.5

所以这意味着 mysql-server-5.5 存在问题,但不确定是什么或为什么,因为这应该是全新的。

感谢您提供的任何时间和/或建议,丹

更新1 找到了一篇有新想法的新帖子,没有运气,但有更多的错误信息可能有助于调试这个问题

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-5.5 (5.5.31-0ubuntu0.13.04.1) ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 mysql-server-5.5
E: Sub-process /usr/bin/dpkg returned an error code (1)

更新2 mysql 中的 error.log 的结果

$ tail /var/log/mysql/error.log
/usr/sbin/mysqld(+0x59043a)[0xb745943a]
/usr/sbin/mysqld(+0x590cd3)[0xb7459cd3]
/usr/sbin/mysqld(+0x585fea)[0xb744efea]
/usr/sbin/mysqld(+0x4c57b9)[0xb738e7b9]
/usr/sbin/mysqld(+0x4b785e)[0xb738085e]
/usr/sbin/mysqld(+0x4ba8f1)[0xb73838f1]
/lib/i386-linux-gnu/libpthread.so.0(+0x6d78)[0xb6e78d78]
/lib/i386-linux-gnu/libc.so.6(clone+0x5e)[0xb6c083de]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
retrobadger@Laptop-Badger:~$ tail -n50 /var/log/mysql/error.log
InnoDB: Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
130509 11:30:18  InnoDB: Assertion failure in thread 2792295232 in file fsp0fsp.c line 3309
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.
10:30:18 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.

key_buffer_size=16777216
read_buffer_size=131072
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 346064 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x33)[0xb72ea683]
/usr/sbin/mysqld(handle_fatal_signal+0x48c)[0xb71af2fc]
[0xb6ea6400]
/usr/sbin/mysqld(+0x53c7da)[0xb74057da]
/usr/sbin/mysqld(+0x4ee825)[0xb73b7825]
/usr/sbin/mysqld(+0x4eefcc)[0xb73b7fcc]
/usr/sbin/mysqld(+0x59043a)[0xb745943a]
/usr/sbin/mysqld(+0x590cd3)[0xb7459cd3]
/usr/sbin/mysqld(+0x585fea)[0xb744efea]
/usr/sbin/mysqld(+0x4c57b9)[0xb738e7b9]
/usr/sbin/mysqld(+0x4b785e)[0xb738085e]
/usr/sbin/mysqld(+0x4ba8f1)[0xb73838f1]
/lib/i386-linux-gnu/libpthread.so.0(+0x6d78)[0xb6e78d78]
/lib/i386-linux-gnu/libc.so.6(clone+0x5e)[0xb6c083de]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

更新3

May  9 09:51:11 Laptop-Badger mysqld_safe[4193]: 130509  9:51:11  InnoDB: Error: page 11444 log sequence number 7800613976
May  9 09:51:11 Laptop-Badger mysqld_safe[4193]: InnoDB: is in the future! Current system log sequence number 7672896206.
May  9 09:51:11 Laptop-Badger mysqld_safe[4193]: InnoDB: Your database may be corrupt or you may have copied the InnoDB
May  9 09:51:11 Laptop-Badger mysqld_safe[4193]: InnoDB: tablespace but not the InnoDB log files. See
May  9 09:51:11 Laptop-Badger mysqld_safe[4193]: InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
May  9 09:51:11 Laptop-Badger mysqld_safe[4193]: InnoDB: for more information.

答案1

为了从上面的评论中得到完整的答案以供后人参考

卸载后,有两个位置可以保留

  1. 设置/etc/mysql。如果其中一个设置确实损坏,则启动守护进程时可能会遇到问题。
  2. 中的数据库/var/lib/mysql。如果您的数据库损坏,尤其是 innodb,启动进程将开始修复这些数据库。如果它们无法修复,您将无法启动 mysql。

删除两者应该可以帮助您解决任何问题。

请注意,如果您删除,您的数据库将会消失/var/lib/mysql,如果您删除,您的设置也将消失/etc/mysql。请务必理解这一点

答案2

记录一下 - 升级到 Ubuntu 13.04 时我遇到了同样的错误。检查错误日志显示磁盘已满。

apt-get clean

释放了 700MB &

apt-get -f install

修复了所有问题。希望这能为某些人节省一些时间。:D

答案3

我读到:“子进程安装的安装后脚本返回错误退出状态 1”

因此,我会尝试这个: http://raphaelhertzog.com/2011/09/13/understand-dpkg-and-dont-get-stuck-with-a-maintainer-script-failure/

相关内容