我最近买了一个 VPS 机箱,预装了 Debian Squeeze 作为操作系统。我升级到了 Debian Wheezy,大多数功能都运行良好(例如 apache)。
我遇到的问题与 MySQL 有关 - 自从升级到 wheezy 后它就无法启动了。我研究了这个问题,并尝试了许多解决方案,比如完全卸载并重新安装 MySQL,但当 MySQL 进程尝试启动时,我还是收到相同的失败消息。
似乎是一个依赖问题——但我不明白它是什么意思!
我尝试了几种解决方案,包括来自该论坛的一些解决方案:
但这些仍未解决问题。
下面是我进行全新安装时的完整消息跟踪 - 非常感谢任何评论/帮助,因为我真的被这个问题难住了!谢谢。
root@vps:~# apt-get install mysql-server mysql-client mysql-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libdbd-mysql-perl libmysqlclient18 mysql-client-5.5 mysql-server-5.5
Suggested packages:
libterm-readkey-perl tinyca
The following NEW packages will be installed:
libdbd-mysql-perl libmysqlclient18 mysql-client mysql-client-5.5 mysql-common mysql-server mysql-server-5.5
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/4598 kB of archives.
After this operation, 71.8 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
dpkg: warning: files list file for package 'liblzma5:i386' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libavahi-common-data:i386' missing; assuming package has no files currently installed
(Reading database ... 29267 files and directories currently installed.)
Unpacking mysql-common (from .../mysql-common_5.5.35+dfsg-0+wheezy1_all.deb) ...
Selecting previously unselected package libmysqlclient18:i386.
Unpacking libmysqlclient18:i386 (from .../libmysqlclient18_5.5.35+dfsg-0+wheezy1_i386.deb) ...
Selecting previously unselected package libdbd-mysql-perl.
Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_4.021-1+b1_i386.deb) ...
Selecting previously unselected package mysql-client-5.5.
Unpacking mysql-client-5.5 (from .../mysql-client-5.5_5.5.35+dfsg-0+wheezy1_i386.deb) ...
Processing triggers for man-db ...
Setting up mysql-common (5.5.35+dfsg-0+wheezy1) ...
Selecting previously unselected package mysql-server-5.5.
dpkg: warning: files list file for package 'liblzma5:i386' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libavahi-common-data:i386' missing; assuming package has no files currently installed
(Reading database ... 29365 files and directories currently installed.)
Unpacking mysql-server-5.5 (from .../mysql-server-5.5_5.5.35+dfsg-0+wheezy1_i386.deb) ...
Selecting previously unselected package mysql-client.
Unpacking mysql-client (from .../mysql-client_5.5.35+dfsg-0+wheezy1_all.deb) ...
Selecting previously unselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_5.5.35+dfsg-0+wheezy1_all.deb) ...
Processing triggers for man-db ...
Setting up libmysqlclient18:i386 (5.5.35+dfsg-0+wheezy1) ...
Setting up libdbd-mysql-perl (4.021-1+b1) ...
Setting up mysql-client-5.5 (5.5.35+dfsg-0+wheezy1) ...
Setting up mysql-server-5.5 (5.5.35+dfsg-0+wheezy1) ...
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
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
Setting up mysql-client (5.5.35+dfsg-0+wheezy1) ...
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.5; however:
Package mysql-server-5.5 is not configured yet.
dpkg: error processing mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-5.5
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
MyISAM 是 MySQL 关系数据库管理系统 5.5 之前版本的默认存储引擎 http://en.wikipedia.org/wiki/MyISAM
Wheezy 不赞成在 MySQL 5.5 中使用 MyISAM。
只需添加:
default-storage-engine=myisam
..[mysqld]
在文件的部分下/etc/mysql/my.cnf
我最近在从 Debian Squeeze 升级到 Wheezy 时遇到了这个问题。升级后,MySQL 无法启动。
我出现的症状与这里发布的症状有点相似:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=682232
然而,提出的解决方案
rm /var/lib/mysql/ib*
..对我没用。
更有趣的是,mysql 日志文件中没有写入任何错误。虽然有错误,但只有 0 字节。顺便说一句,目录/var/log/mysql
是空的。
wordpress:~# l -dg /var/log/mysql*
drwxr-s--- 2 adm 4.0K Jun 10 2010 /var/log/mysql
-rw-r----- 1 adm 0 Oct 9 15:06 /var/log/mysql.err
-rw-r----- 1 adm 0 Oct 9 15:06 /var/log/mysql.log
然后我mysqld
从命令行运行该命令。这最终产生了一些有用的信息:
wordpress:~# mysqld
141009 15:39:50 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
141009 15:39:50 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
141009 15:39:50 [Note] Plugin 'FEDERATED' is disabled.
141009 15:39:50 InnoDB: The InnoDB memory heap is disabled
141009 15:39:50 InnoDB: Mutexes and rw_locks use GCC atomic builtins
141009 15:39:50 InnoDB: Compressed tables use zlib 1.2.7
141009 15:39:50 InnoDB: Using Linux native AIO
141009 15:39:50 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(135987200 bytes) failed; errno 12
141009 15:39:50 InnoDB: Completed initialization of buffer pool
141009 15:39:50 InnoDB: Fatal error: cannot allocate memory for the buffer pool
141009 15:39:50 [ERROR] Plugin 'InnoDB' init function returned error.
141009 15:39:50 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
141009 15:39:50 [ERROR] Unknown/unsupported storage engine: InnoDB
141009 15:39:50 [ERROR] Aborting
141009 15:39:50 [Note] mysqld: Shutdown complete
显然,不支持 InnoDB。这对我来说没问题,因为我MyISAM
过去一直在这台服务器上使用。
对其中一些错误的快速搜索指向一个链接(也在 ServerFault 上),其中一条评论中有答案:
未知/不受支持的存储引擎:InnoDB | MySQL Ubuntu
关键是按照 Andy Mikhaylenko 的回答指定默认存储引擎。
显然,答案也提到了添加,skip-innodb
但这不是我的系统重新启动 MySQL 的要求。
答案2
此外,我得到了错误
160307 21:49:22 [错误] mysqld:未知选项“--skip-bdb”
所以必须注释掉这个选项
skip-bdb
因为 mysqld 5.5 显然不再知道这一点。可能是相当老版本的 mysql 遗留的,因为这个盒子是从 Debian sarge 开始的。