我正在尝试在ubuntu22.04LTS上安装mysql服务器,但是我得到了以下dpkg错误消息。我怎样才能解决这个问题?
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
mysql-client-8.0 mysql-client-core-8.0 mysql-common mysql-server-8.0 mysql-server-ore-8.0
Suggested packages:
mailx tinyca
The following NEW packages will be installed:
mysql-client-8.0 mysql-client-core-8.0 mysql-common mysql-server mysql-server-8.0 mysql-server-core-8.0
0 upgraded, 6 newly installed, 0 to remove and 3 not upgraded.
Need to get 0 B/21.1 MB of archives.
After this operation, 182 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 201995 files and directories currently installed.)
Preparing to unpack .../mysql-common_1%3a10.5.15+maria~focal_all.deb ...
Unpacking mysql-common (1:10.5.15+maria~focal) ...
Selecting previously unselected package mysql-client-core-8.0.
Preparing to unpack .../mysql-client-core-8.0_8.0.28-0ubuntu4_amd64.deb ...
Unpacking mysql-client-core-8.0 (8.0.28-0ubuntu4) ...
Selecting previously unselected package mysql-client-8.0.
Preparing to unpack .../mysql-client-8.0_8.0.28-0ubuntu4_amd64.deb ...
Unpacking mysql-client-8.0 (8.0.28-0ubuntu4) ...
Selecting previously unselected package mysql-server-core-8.0.
Preparing to unpack .../mysql-server-core-8.0_8.0.28-0ubuntu4_amd64.deb ...
Unpacking mysql-server-core-8.0 (8.0.28-0ubuntu4) ...
Setting up mysql-common (1:10.5.15+maria~focal) ...
Selecting previously unselected package mysql-server-8.0.
(Reading database ... 202191 files and directories currently installed.)
Preparing to unpack .../mysql-server-8.0_8.0.28-0ubuntu4_amd64.deb ...
Unpacking mysql-server-8.0 (8.0.28-0ubuntu4) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_8.0.28-0ubuntu4_all.deb ...
Unpacking mysql-server (8.0.28-0ubuntu4) ...
Setting up mysql-client-core-8.0 (8.0.28-0ubuntu4) ...
Setting up mysql-server-core-8.0 (8.0.28-0ubuntu4) ...
Setting up mysql-client-8.0 (8.0.28-0ubuntu4) ...
Setting up mysql-server-8.0 (8.0.28-0ubuntu4) ...
/var/lib/dpkg/info/mysql-server-8.0.postinst: line 194: /usr/share/mysql-
common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-8.0 (--configure):
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 127
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-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 man-db (2.10.2-1) ...
Errors were encountered while processing:
mysql-server-8.0
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)虽然运行命令mysqld -V命令会产生以下输出-
/usr/sbin/mysqld Ver 8.0.28-0ubuntu 4 for Linux on x86_64 ((Ubuntu))
执行命令sudo service mysql start会产生以下错误代码-
mysql.service的作业失败,因为控制进程存在错误代码。有关详细信息,请参阅"systemctl status mysql.service“和"journalctl -xeu mysql.service”。
发布于 2022-06-29 20:07:15
将我的答案转发给这里类似的问题。我能够在Ubuntu22.04上使用S 21岁解决方案来解决这个问题,关于20.04的类似问题本身就是从这里复制的。
从第一次安装失败开始,问题似乎来自于文件系统中的某些部分初始化。因此,解决方案基本上是确保清除在失败的安装尝试中添加或修改的所有内容。
我没有时间深入到更深的地方,所以我不知道哪些文件应该受到指责,但是如果有人能提供更多的见解,请在下面评论那些需要更微妙解决方案的未来读者。
sudo systemctl stop mysqlsudo apt purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysqlsudo apt autoremove
sudo apt autocleansudo reboot现在,在筛选了任何挥之不去的配置后,您应该能够再次运行install命令。
我还读到这里,有些人在Jammy上安装mysql-server时遇到了问题,建议安装特定的mysql-server-8.0和mysql-server-core-8.0包。不能100%确定这一点的真实性,因为我没有在彻底清除之后再次尝试mysql-server元打包。
sudo apt install mysql-server-core-8.0 mysql-server-8.0希望这能有所帮助!
发布于 2022-10-27 20:28:52
自从我安装了来自第三方repos的最新MariaDB版本后,我遇到了同样的问题。
输出中的这一行提示了这个问题:
/usr/share/mysql-common/configure-symlinks: No such file or directory当试图删除/清除包时,mysql-common apt声明了许多其他应用程序包的依赖关系。
apt remove mysql-server mysql-server-8.0还删除所有剩余的mariadb服务器包。/etc/apt/sources.list.d/文件夹,并按#字符或/etc/apt/sources.list.d/重命名/移动/删除文件apt updateapt -a show mysql-common,并降级为Ubuntu包版本sudo apt install mysql-common=<VERSION>或apt install mysql-serverhttps://askubuntu.com/questions/1405475
复制相似问题