使用 apt-get 更新 mysql 时出错(Debian)

使用 apt-get 更新 mysql 时出错(Debian)

我正在运行 Debian 7 (wheezy) 机器,并且我正在进行常规软件包更新,apt-get update && apt-get upgrade除了 mysql 服务器之外,所有内容似乎都已更新。运行时我得到了以下输出apt-get upgrade

The following packages will be upgraded:
mysql-server-5.5
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
18 not fully installed or removed.
Need to get 0 B/2,092 kB of archives.
After this operation, 2,048 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Reading changelogs... Done
Preconfiguring packages ...
(Reading database ... 24785 files and directories currently installed.)
Preparing to replace mysql-server-5.5 5.5.40-0+wheezy1 (using .../mysql-server-5.5_5.5.44-0+deb7u1_amd64.deb) ...
[FAIL] Stopping MySQL database server: mysqld failed!
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
[FAIL] Stopping MySQL database server: mysqld failed!
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/mysql-server-5.5_5.5.44-0+deb7u1_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
[FAIL] Stopping MySQL database server: mysqld failed!
invoke-rc.d: initscript mysql, action "stop" failed.
[ ok ] Starting MySQL database server: mysqld already running.
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.5_5.5.44-0+deb7u1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

看起来好像无法停止服务器,但我不想做任何鲁莽的事情,因为这是一个生产服务器。有什么建议吗?

谢谢

答案1

Apt 告诉您启动脚本失败stop。很可能 apt 已正确安装新代码,然后尝试通过运行来激活它

# /etc/init.d/mysql restart

这与

# /etc/init.d/mysql stop
# /etc/init.d/mysql start

您可以尝试手动运行。最安全的形式是

# /usr/bin/service mysql restart

但首先我要检查

/var/log/syslog
/var/log/mysql.log
/var/log/mysql.err

错误可能有一个简单的原因,您可以修复它,或者有一个更严重的错误情况,您会很高兴知道它。

相关内容