Ubuntu

安裝 Fpart 時 Ubuntu 正在設置 MySQL

  • June 23, 2020

我正在嘗試安裝 fpart,但出現 mysql 錯誤:

# apt install fpart
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
 linux-aws-headers-4.4.0-1090 linux-aws-headers-4.4.0-1092 linux-aws-headers-4.4.0-1094 linux-aws-headers-4.4.0-1095 linux-aws-headers-4.4.0-1096 linux-aws-headers-4.4.0-1098
 linux-aws-headers-4.4.0-1100 linux-aws-headers-4.4.0-1101 linux-aws-headers-4.4.0-1102 linux-aws-headers-4.4.0-1104 linux-aws-headers-4.4.0-1105 linux-aws-headers-4.4.0-1106
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
 fpart
0 upgraded, 1 newly installed, 0 to remove and 48 not upgraded.
2 not fully installed or removed.
Need to get 36.2 kB of archives.
After this operation, 119 kB of additional disk space will be used.
Get:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial/universe amd64 fpart amd64 0.9.2-1 [36.2 kB]
Fetched 36.2 kB in 0s (318 kB/s) 
Selecting previously unselected package fpart.
(Reading database ... 358221 files and directories currently installed.)
Preparing to unpack .../fpart_0.9.2-1_amd64.deb ...
Unpacking fpart (0.9.2-1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-server-5.7 (5.7.30-0ubuntu0.16.04.1) ...
insserv: warning: current start runlevel(s) (empty) of script `mysql' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `mysql' overrides LSB defaults (0 1 6).
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                         dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
 Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Setting up fpart (0.9.2-1) ...
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

顯然,列表中沒有mysql這樣的依賴:

# apt depends fpart
fpart
 Depends: libc6 (>= 2.4)
 Depends: rsync (>= 3.1.1)
 Depends: sudo (>= 1.8.12)

這種行為的原因可能是什麼?也許有未完成的 MySQL 安裝?

# apt list --installed | grep -i mysql
dbconfig-mysql/xenial,now 2.0.4ubuntu1 all [installed,automatic]
mysql-client/xenial-updates,xenial-security,now 5.7.30-0ubuntu0.16.04.1 all [installed]
mysql-client-5.7/xenial-updates,xenial-security,now 5.7.30-0ubuntu0.16.04.1 amd64 [installed,automatic]
mysql-client-core-5.7/xenial-updates,xenial-security,now 5.7.30-0ubuntu0.16.04.1 amd64 [installed,automatic]
mysql-common/xenial-updates,xenial-security,now 5.7.30-0ubuntu0.16.04.1 all [installed]
mysql-server/xenial-updates,xenial-security,now 5.7.30-0ubuntu0.16.04.1 all [installed]
mysql-server-5.7/xenial-updates,xenial-security,now 5.7.30-0ubuntu0.16.04.1 amd64 [installed,automatic]
mysql-server-core-5.7/xenial-updates,xenial-security,now 5.7.30-0ubuntu0.16.04.1 amd64 [installed,automatic]
php-mysql/xenial-updates,now 1:7.0+35ubuntu6.1 all [installed]
php7.0-mysql/xenial-updates,xenial-security,now 7.0.33-0ubuntu0.16.04.15 amd64 [installed,automatic]

所以# ps aux | grep -i mysql | grep -v grepMySQL 沒有執行

看起來 MySQL 升級過程失敗了。

如果您修改了 MySQL 系統使用者,則升級可能會失敗,因為它無法通過 MySQL 套接字進行身份驗證。

另一種可能是您的 MySQL 伺服器沒有執行,因此升級過程無法連接到伺服器。

引用自:https://serverfault.com/questions/1022469