我尝试重新安装 MySQL,但遇到了问题。最初,我尝试通过重新安装 GNOME 控制中心来解决问题,但这没有奏效,而且我在尝试重新安装 MySQL 时仍然遇到问题。
我无法通过在终端上运行以下命令来重新安装 Gnome 控制中心:
sudo apt-get install --reinstall gnome-control-center
我在终端上收到以下输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 29 not upgraded.
2 not fully installed or removed.
Need to get 0 B/1718 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 297079 files and directories currently installed.)
Preparing to unpack .../gnome-control-center_1%3a3.36.5-0ubuntu2_amd64.deb ...
Unpacking gnome-control-center (1:3.36.5-0ubuntu2) over (1:3.36.5-0ubuntu2) ...
Setting up mysql-server-8.0 (8.0.26-0ubuntu0.20.04.2) ...
Renaming removed key_buffer and myisam-recover options (if present)
ERROR: Unable to start MySQL server:
mysqld: Can't read dir of '/etc/mysql/conf.d/' (OS errno 13 - Permission denied)
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues.
Once the problem is resolved, run apt-get --fix-broken install to retry.
dpkg: error processing package mysql-server-8.0 (--configure):
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Setting up gnome-control-center (1:3.36.5-0ubuntu2) ...
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-8.0; however:
Package mysql-server-8.0 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Processing triggers for mime-support (3.64ubuntu1) ...
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Errors were encountered while processing:
mysql-server-8.0
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
并且重新安装崩溃。
运行后:
ls -l /var/crash
我在终端上得到以下输出:
total 200
-rw------- 1 root whoopsie 203863 Sep 13 14:11 mysql-server-8.0.0.crash
还:
sudo apt update
is giving this output:
Ign:1 cdrom://Ubuntu 18.04.3 LTS _Bionic Beaver_ - Release amd64 (20190805) bionic InRelease
Hit:2 cdrom://Ubuntu 18.04.3 LTS _Bionic Beaver_ - Release amd64 (20190805) bionic Release
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:4 http://dl.google.com/linux/chrome/deb stable InRelease [1811 B]
Hit:6 http://ppa.launchpad.net/mkusb/ppa/ubuntu bionic InRelease
Hit:7 http://archive.ubuntu.com/ubuntu focal InRelease
Get:8 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:9 http://dl.google.com/linux/chrome/deb stable/main amd64 Packages [1096 B]
Get:10 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [27.7 kB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [61.0 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2468 B]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [282 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/main DEP-11 48x48 Icons [60.5 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [351 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [944 B]
Fetched 1017 kB in 2s (665 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
30 packages can be upgraded. Run 'apt list --upgradable' to see them.
并sudo apt upgrade
给出以下输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
firefox firefox-locale-de firefox-locale-en firefox-locale-es firefox-locale-fr firefox-locale-he firefox-locale-it firefox-locale-pt
firefox-locale-ru firefox-locale-zh-hans ghostscript ghostscript-x google-chrome-stable libapache2-mod-php7.4 libgs9 libgs9-common php7.4
php7.4-bz2 php7.4-cli php7.4-common php7.4-curl php7.4-gd php7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-xml
php7.4-zip wireless-regdb
30 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
15 standard security updates
Need to get 154 MB of archives.
After this operation, 581 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://dl.google.com/linux/chrome/deb stable/main amd64 google-chrome-stable amd64 93.0.4577.82-1 [82.9 MB]
Get:2 http://security.ubuntu.com/ubuntu focal-security/main amd64 firefox amd64 92.0+build3-0ubuntu0.20.04.1 [57.3 MB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 php7.4-zip amd64 7.4.3-4ubuntu2.6 [21.6 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 php7.4-mbstring amd64 7.4.3-4ubuntu2.6 [397 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 php7.4-bz2 amd64 7.4.3-4ubuntu2.6 [10.4 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 php7.4-xml amd64 7.4.3-4ubuntu2.6 [97.2 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 php7.4-readline amd64 7.4.3-4ubuntu2.6 [12.6 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 php7.4-opcache amd64 7.4.3-4ubuntu2.6 [198 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 php7.4-mysql amd64 7.4.3-4ubuntu2.6 [121 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 php7.4-json amd64 7.4.3-4ubuntu2.6 [19.2 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 php7.4-gd amd64 7.4.3-4ubuntu2.6 [27.9 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 php7.4-curl amd64 7.4.3-4ubuntu2.6 [31.0 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libapache2-mod-php7.4 amd64 7.4.3-4ubuntu2.6 [1364 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 php7.4-cli amd64 7.4.3-4ubuntu2.6 [1420 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 php7.4-common amd64 7.4.3-4ubuntu2.6 [980 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 php7.4 all 7.4.3-4ubuntu2.6 [9236 B]
Get:17 http://security.ubuntu.com/ubuntu focal-security/main amd64 firefox-locale-de amd64 92.0+build3-0ubuntu0.20.04.1 [492 kB]
Get:18 http://security.ubuntu.com/ubuntu focal-security/main amd64 firefox-locale-en amd64 92.0+build3-0ubuntu0.20.04.1 [686 kB]
Get:19 http://security.ubuntu.com/ubuntu focal-security/main amd64 firefox-locale-es amd64 92.0+build3-0ubuntu0.20.04.1 [1787 kB]
Get:20 http://security.ubuntu.com/ubuntu focal-security/main amd64 firefox-locale-fr amd64 92.0+build3-0ubuntu0.20.04.1 [495 kB]
Get:21 http://security.ubuntu.com/ubuntu focal-security/main amd64 firefox-locale-he amd64 92.0+build3-0ubuntu0.20.04.1 [489 kB]
Get:22 http://security.ubuntu.com/ubuntu focal-security/main amd64 firefox-locale-it amd64 92.0+build3-0ubuntu0.20.04.1 [397 kB]
Get:23 http://security.ubuntu.com/ubuntu focal-security/main amd64 firefox-locale-pt amd64 92.0+build3-0ubuntu0.20.04.1 [927 kB]
Get:24 http://security.ubuntu.com/ubuntu focal-security/main amd64 firefox-locale-ru amd64 92.0+build3-0ubuntu0.20.04.1 [559 kB]
Get:25 http://security.ubuntu.com/ubuntu focal-security/main amd64 firefox-locale-zh-hans amd64 92.0+build3-0ubuntu0.20.04.1 [502 kB]
Get:26 http://security.ubuntu.com/ubuntu focal-security/main amd64 ghostscript-x amd64 9.50~dfsg-5ubuntu4.3 [43.9 kB]
Get:27 http://security.ubuntu.com/ubuntu focal-security/main amd64 ghostscript amd64 9.50~dfsg-5ubuntu4.3 [51.8 kB]
Get:28 http://security.ubuntu.com/ubuntu focal-security/main amd64 libgs9 amd64 9.50~dfsg-5ubuntu4.3 [2172 kB]
Get:29 http://security.ubuntu.com/ubuntu focal-security/main amd64 libgs9-common all 9.50~dfsg-5ubuntu4.3 [681 kB]
Get:30 http://security.ubuntu.com/ubuntu focal-security/main amd64 wireless-regdb all 2021.08.28-0ubuntu1~20.04.1 [10.0 kB]
Fetched 154 MB in 23s (6768 kB/s)
(Reading database ... 297079 files and directories currently installed.)
Preparing to unpack .../00-google-chrome-stable_93.0.4577.82-1_amd64.deb ...
Unpacking google-chrome-stable (93.0.4577.82-1) over (93.0.4577.63-1) ...
Preparing to unpack .../01-firefox_92.0+build3-0ubuntu0.20.04.1_amd64.deb ...
Unpacking firefox (92.0+build3-0ubuntu0.20.04.1) over (91.0.2+build1-0ubuntu0.20.04.1) ...
Preparing to unpack .../02-firefox-locale-de_92.0+build3-0ubuntu0.20.04.1_amd64.deb ...
Unpacking firefox-locale-de (92.0+build3-0ubuntu0.20.04.1) over (91.0.2+build1-0ubuntu0.20.04.1) ...
Preparing to unpack .../03-firefox-locale-en_92.0+build3-0ubuntu0.20.04.1_amd64.deb ...
Unpacking firefox-locale-en (92.0+build3-0ubuntu0.20.04.1) over (91.0.2+build1-0ubuntu0.20.04.1) ...
Preparing to unpack .../04-firefox-locale-es_92.0+build3-0ubuntu0.20.04.1_amd64.deb ...
Unpacking firefox-locale-es (92.0+build3-0ubuntu0.20.04.1) over (91.0.2+build1-0ubuntu0.20.04.1) ...
Preparing to unpack .../05-firefox-locale-fr_92.0+build3-0ubuntu0.20.04.1_amd64.deb ...
Unpacking firefox-locale-fr (92.0+build3-0ubuntu0.20.04.1) over (91.0.2+build1-0ubuntu0.20.04.1) ...
Preparing to unpack .../06-firefox-locale-he_92.0+build3-0ubuntu0.20.04.1_amd64.deb ...
Unpacking firefox-locale-he (92.0+build3-0ubuntu0.20.04.1) over (91.0.2+build1-0ubuntu0.20.04.1) ...
Preparing to unpack .../07-firefox-locale-it_92.0+build3-0ubuntu0.20.04.1_amd64.deb ...
Unpacking firefox-locale-it (92.0+build3-0ubuntu0.20.04.1) over (91.0.2+build1-0ubuntu0.20.04.1) ...
Preparing to unpack .../08-firefox-locale-pt_92.0+build3-0ubuntu0.20.04.1_amd64.deb ...
Unpacking firefox-locale-pt (92.0+build3-0ubuntu0.20.04.1) over (91.0.2+build1-0ubuntu0.20.04.1) ...
Preparing to unpack .../09-firefox-locale-ru_92.0+build3-0ubuntu0.20.04.1_amd64.deb ...
Unpacking firefox-locale-ru (92.0+build3-0ubuntu0.20.04.1) over (91.0.2+build1-0ubuntu0.20.04.1) ...
Preparing to unpack .../10-firefox-locale-zh-hans_92.0+build3-0ubuntu0.20.04.1_amd64.deb ...
Unpacking firefox-locale-zh-hans (92.0+build3-0ubuntu0.20.04.1) over (91.0.2+build1-0ubuntu0.20.04.1) ...
Preparing to unpack .../11-ghostscript-x_9.50~dfsg-5ubuntu4.3_amd64.deb ...
Unpacking ghostscript-x (9.50~dfsg-5ubuntu4.3) over (9.50~dfsg-5ubuntu4.2) ...
Preparing to unpack .../12-ghostscript_9.50~dfsg-5ubuntu4.3_amd64.deb ...
Unpacking ghostscript (9.50~dfsg-5ubuntu4.3) over (9.50~dfsg-5ubuntu4.2) ...
Preparing to unpack .../13-libgs9_9.50~dfsg-5ubuntu4.3_amd64.deb ...
Unpacking libgs9:amd64 (9.50~dfsg-5ubuntu4.3) over (9.50~dfsg-5ubuntu4.2) ...
Preparing to unpack .../14-libgs9-common_9.50~dfsg-5ubuntu4.3_all.deb ...
Unpacking libgs9-common (9.50~dfsg-5ubuntu4.3) over (9.50~dfsg-5ubuntu4.2) ...
Preparing to unpack .../15-php7.4-zip_7.4.3-4ubuntu2.6_amd64.deb ...
Unpacking php7.4-zip (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../16-php7.4-mbstring_7.4.3-4ubuntu2.6_amd64.deb ...
Unpacking php7.4-mbstring (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../17-php7.4-bz2_7.4.3-4ubuntu2.6_amd64.deb ...
Unpacking php7.4-bz2 (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../18-php7.4-xml_7.4.3-4ubuntu2.6_amd64.deb ...
Unpacking php7.4-xml (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../19-php7.4-readline_7.4.3-4ubuntu2.6_amd64.deb ...
Unpacking php7.4-readline (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../20-php7.4-opcache_7.4.3-4ubuntu2.6_amd64.deb ...
Unpacking php7.4-opcache (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../21-php7.4-mysql_7.4.3-4ubuntu2.6_amd64.deb ...
Unpacking php7.4-mysql (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../22-php7.4-json_7.4.3-4ubuntu2.6_amd64.deb ...
Unpacking php7.4-json (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../23-php7.4-gd_7.4.3-4ubuntu2.6_amd64.deb ...
Unpacking php7.4-gd (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../24-php7.4-curl_7.4.3-4ubuntu2.6_amd64.deb ...
Unpacking php7.4-curl (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../25-libapache2-mod-php7.4_7.4.3-4ubuntu2.6_amd64.deb ...
Unpacking libapache2-mod-php7.4 (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../26-php7.4-cli_7.4.3-4ubuntu2.6_amd64.deb ...
Unpacking php7.4-cli (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../27-php7.4-common_7.4.3-4ubuntu2.6_amd64.deb ...
Unpacking php7.4-common (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../28-php7.4_7.4.3-4ubuntu2.6_all.deb ...
Unpacking php7.4 (7.4.3-4ubuntu2.6) over (7.4.3-4ubuntu2.5) ...
Preparing to unpack .../29-wireless-regdb_2021.08.28-0ubuntu1~20.04.1_all.deb ...
Unpacking wireless-regdb (2021.08.28-0ubuntu1~20.04.1) over (2021.07.14-0ubuntu1~20.04.1) ...
Setting up libgs9-common (9.50~dfsg-5ubuntu4.3) ...
Setting up firefox-locale-fr (92.0+build3-0ubuntu0.20.04.1) ...
Setting up mysql-server-8.0 (8.0.26-0ubuntu0.20.04.2) ...
Renaming removed key_buffer and myisam-recover options (if present)
ERROR: Unable to start MySQL server:
mysqld: Can't read dir of '/etc/mysql/conf.d/' (OS errno 13 - Permission denied)
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues.
Once the problem is resolved, run apt-get --fix-broken install to retry.
dpkg: error processing package mysql-server-8.0 (--configure):
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Setting up firefox-locale-ru (92.0+build3-0ubuntu0.20.04.1) ...
Setting up google-chrome-stable (93.0.4577.82-1) ...
Setting up php7.4-common (7.4.3-4ubuntu2.6) ...
Setting up libgs9:amd64 (9.50~dfsg-5ubuntu4.3) ...
Setting up php7.4-curl (7.4.3-4ubuntu2.6) ...
Setting up php7.4-mysql (7.4.3-4ubuntu2.6) ...
Setting up firefox (92.0+build3-0ubuntu0.20.04.1) ...
Please restart all running instances of firefox, or you will experience problems.
Setting up wireless-regdb (2021.08.28-0ubuntu1~20.04.1) ...
Setting up php7.4-readline (7.4.3-4ubuntu2.6) ...
Setting up php7.4-mbstring (7.4.3-4ubuntu2.6) ...
Setting up php7.4-bz2 (7.4.3-4ubuntu2.6) ...
Setting up ghostscript (9.50~dfsg-5ubuntu4.3) ...
Setting up php7.4-zip (7.4.3-4ubuntu2.6) ...
Setting up firefox-locale-en (92.0+build3-0ubuntu0.20.04.1) ...
Setting up firefox-locale-es (92.0+build3-0ubuntu0.20.04.1) ...
Setting up firefox-locale-pt (92.0+build3-0ubuntu0.20.04.1) ...
Setting up php7.4-opcache (7.4.3-4ubuntu2.6) ...
Setting up firefox-locale-zh-hans (92.0+build3-0ubuntu0.20.04.1) ...
Setting up firefox-locale-he (92.0+build3-0ubuntu0.20.04.1) ...
Setting up firefox-locale-de (92.0+build3-0ubuntu0.20.04.1) ...
Setting up php7.4-gd (7.4.3-4ubuntu2.6) ...
Setting up firefox-locale-it (92.0+build3-0ubuntu0.20.04.1) ...
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-8.0; however:
Package mysql-server-8.0 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Setting up php7.4-json (7.4.3-4ubuntu2.6) ...
No apport report written because the error message indicates its a followup error from a previous failure.
Setting up php7.4-xml (7.4.3-4ubuntu2.6) ...
Setting up ghostscript-x (9.50~dfsg-5ubuntu4.3) ...
Setting up php7.4-cli (7.4.3-4ubuntu2.6) ...
Setting up libapache2-mod-php7.4 (7.4.3-4ubuntu2.6) ...
libapache2-mod-php7.4: not switching MPM - already enabled
Setting up php7.4 (7.4.3-4ubuntu2.6) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for php7.4-cli (7.4.3-4ubuntu2.6) ...
Processing triggers for libapache2-mod-php7.4 (7.4.3-4ubuntu2.6) ...
Errors were encountered while processing:
mysql-server-8.0
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
任何帮助,将不胜感激。
编辑:
按照要求提供更多信息,我跑了
dpkg-query -l mysql-server-8.0
并收到以下输出:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-================-=======================-============-========================================================
iF mysql-server-8.0 8.0.26-0ubuntu0.20.04.2 amd64 MySQL database server binaries and system database setup
此外,根据请求附加信息(2),我跑了
ls -l /etc/mysql/conf.d/
并收到以下输出:
total 8
-rw-r--r-- 1 root root 8 Aug 3 2016 mysql.cnf
-rw-r--r-- 1 root root 55 Aug 3 2016 mysqldump.cnf
此外,根据请求附加信息(3),我跑了
ls -l /etc/mysql/
并收到以下输出:
total 24
drwxr-xr-x 2 root root 4096 Sep 15 18:50 conf.d
-rwxr-xr-x 1 root root 120 Jul 22 07:53 debian-start
-rw------- 1 root root 317 Sep 16 13:45 debian.cnf.bak
lrwxrwxrwx 1 root root 24 Sep 16 14:13 my.cnf -> /etc/alternatives/my.cnf
lrwxrwxrwx 1 root root 24 Sep 15 18:50 my.cnf.bak -> /etc/alternatives/my.cnf
-rw-r--r-- 1 root root 839 Aug 3 2016 my.cnf.fallback
-rw-r--r-- 1 root root 682 Nov 6 2019 mysql.cnf
drwxr-xr-x 2 root root 4096 Sep 16 14:26 mysql.conf.d
答案1
~ 编辑 ~
根据您发布的输出中的以下几行来判断:
mysql-server depends on mysql-server-8.0; however:
Package mysql-server-8.0 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
我很确定你只需要跑
sudo apt install mysql-server-8.0
正如我下面所说(说?),有两个几乎同名的包,所以我可以看出这是一个容易疏忽的问题。不确定为什么它不从一开始就抓取依赖项,但无论如何,上面的命令应该可以解决问题。
~ 总结:~
我在下面的底部列出了 2 个修复方法。您可以继续尝试第一个,因为它很可能是您需要的,但请等到我看到我要求的输出后再转到第二个。
对于 mysql 8.0,有 2 个不同的 Apt 包,均位于同一个存储库(建议使用焦点)中。其中一个的命名和版本如下:
mysql-server/focal-proposed,focal-proposed 8.0.26-0ubuntu0.20.04.3 all
和另一个:
mysql-server-8.0/focal-proposed 8.0.26-0ubuntu0.20.04.3 amd64
你有两者吗?
dpkg-query
为了确保万无一失,请对两者运行以下命令。
固定在底部。
笔记:
下一节将介绍如何确定问题,但无论如何,修复方法(写在本文底部)都是相同的。是否要继续或跳过,取决于您。
~ 查明原因 ~
从上面说的来看,你需要这两个。第二个依赖于架构,另一个适用于任何 Ubuntu 桌面系统。
您的下一步取决于运行以下命令所获得的结果:
dpkg-query -l mysql-server-8.0
输出中的字符代码代表状态以及其他信息。
如果显示未安装,那是因为您使用的是不同版本的 mysql。另外,请注意版本号是问题版本的软件包名称的一部分?这是因为此软件包中,MySQL 8.0
不是旧版本的更新。因此,您不能直接用 更新它apt upgrade
。维护 MySQL 的人决定将其作为完全独立的软件包发布,因此从旧软件包更新到此软件包mysql-server-xxx
就像从 升级postgres
到MySQL
... 一样不可能。
如果显示介于两者之间not installed
,则installed
只需 1 个命令即可修复,但我们确实需要知道安装过程进行到了何种程度,才能知道最有效的修复方法。上面的命令应该可以提供这些信息。
尽管下面的第二种方法无论如何都应该可以解决问题,但还有更好的方法。这种方法被放在最后是有原因的。如果更好的方法没有奏效,那么这种方法就是万能的。此外,如果解决方案部分中的第一个命令没有首先运行,最后一个命令可能会出错。
~ 回答 ~
首先,您可以尝试配置/重新配置。您的系统上有 2 个软件包需要这个,希望至少 1 个是软件包mysql-server
。配置所有需要它的软件包的命令是:
dpkg --configure --pending
如果配置不起作用,解决此问题的最佳方法是删除旧包,然后安装mysql-server
并mysql-server-8.0
更新。只要您不要使用该--purge
选项!使用此选项将删除所有内容!
如果必须这样做,请先在 Google 上查找已经这样做的人。列出依赖项由 pkg 开发人员负责,配置中的错误可能会导致大问题。这种情况很少见,但仍然值得花 1-2 分钟在 Google 上搜索该短语apt remove mysql
。
删除并重新安装的命令是:
sudo apt remove mysql-server-8.0 && sudo apt install
答案2
我对这个错误信息更好奇:
Renaming removed key_buffer and myisam-recover options (if present) ERROR: Unable to start MySQL server: mysqld: Can't read dir of '/etc/mysql/conf.d/' (OS errno 13 - Permission denied) mysqld: [ERROR] Fatal error in defaults handling. Program aborted! Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues. Once the problem is resolved, run apt-get --fix-broken install to retry. dpkg: error processing package mysql-server-8.0 (--configure): installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
先修复一下安装到一半的包:
sudo mv /var/lib/dpkg/info/mysql-server-8.0.postinst /var/lib/dpkg/info/mysql-server-8.0.postinst.backup sudo apt -f install sudo mv /var/lib/dpkg/info/mysql-server-8.0.postinst.backup /var/lib/dpkg/info/mysql-server-8.0.postinst
再次检查 mysql 服务器是否重新启动正常:
sudo service mysql restart
答案3
错误很可能是由于包装损坏造成的。我会尝试以下方法:
sudo dpkg --remove --force-remove-reinstreq mysql-server && sudo apt-get clean && sudo apt-get autoremove && sudo apt-get update --fix-missing && sudo apt-get update
之后尝试重新安装 gnome-control-center(或 mysql-server),希望一切正常。