使用 apt-get 更新 mysql 時發生錯誤 (Debian)

使用 apt-get 更新 mysql 時發生錯誤 (Debian)

我正在運行一台 Debian 7(喘息)機器,並且正在執行正常的軟體包更新,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 告訴您 initscript 失敗了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

可能有一個您可以修復的錯誤原因,也可能有一個您很樂意了解的更嚴重的錯誤情況。

相關內容