首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在ubuntu22.04LTS上安装mysql-服务器

无法在ubuntu22.04LTS上安装mysql-服务器
EN

Ask Ubuntu用户
提问于 2022-04-29 08:46:47
回答 2查看 15.9K关注 0票数 7

我正在尝试在ubuntu22.04LTS上安装mysql服务器,但是我得到了以下dpkg错误消息。我怎样才能解决这个问题?

代码语言:javascript
复制
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”。

EN

回答 2

Ask Ubuntu用户

发布于 2022-06-29 20:07:15

将我的答案转发给这里类似的问题。我能够在Ubuntu22.04上使用S 21岁解决方案来解决这个问题,关于20.04的类似问题本身就是从这里复制的。

概述

从第一次安装失败开始,问题似乎来自于文件系统中的某些部分初始化。因此,解决方案基本上是确保清除在失败的安装尝试中添加或修改的所有内容。

我没有时间深入到更深的地方,所以我不知道哪些文件应该受到指责,但是如果有人能提供更多的见解,请在下面评论那些需要更微妙解决方案的未来读者。

清除相关软件包

  • 确保MySQL没有运行:
代码语言:javascript
复制
sudo systemctl stop mysql
  • 然后清除所有MySQL包:
代码语言:javascript
复制
sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
  • 然后删除所有MySQL文件:
代码语言:javascript
复制
sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql
  • 最后,清理所有不需要的包:
代码语言:javascript
复制
sudo apt autoremove
sudo apt autoclean
  • 在继续前进之前重新启动也不会有任何伤害。
代码语言:javascript
复制
sudo reboot

现在,在筛选了任何挥之不去的配置后,您应该能够再次运行install命令。

MySQL Apt套餐备注

我还读到这里,有些人在Jammy上安装mysql-server时遇到了问题,建议安装特定的mysql-server-8.0mysql-server-core-8.0包。不能100%确定这一点的真实性,因为我没有在彻底清除之后再次尝试mysql-server元打包。

代码语言:javascript
复制
sudo apt install mysql-server-core-8.0 mysql-server-8.0

希望这能有所帮助!

票数 10
EN

Ask Ubuntu用户

发布于 2022-10-27 20:28:52

自从我安装了来自第三方repos的最新MariaDB版本后,我遇到了同样的问题。

输出中的这一行提示了这个问题:

代码语言:javascript
复制
/usr/share/mysql-common/configure-symlinks: No such file or directory

当试图删除/清除包时,mysql-common apt声明了许多其他应用程序包的依赖关系。

溶液

  • 删除mysql服务器包apt remove mysql-server mysql-server-8.0还删除所有剩余的mariadb服务器包。
  • 从MariaDB中删除任何第三方回购。
    • 使用Synaptic包管理器或
    • 手动编辑文件/etc/apt/sources.list.d/文件夹,并按#字符或
    • /etc/apt/sources.list.d/重命名/移动/删除文件

  • 更新apt回购系统apt update
  • 将mysql-公共包降级为Ubuntu版本。
    • 使用Synaptic包管理器或
    • 列出所有可用源/版本apt -a show mysql-common,并降级为Ubuntu包版本sudo apt install mysql-common=<VERSION>
    • 使用智能CLI包管理器,并尝试删除mysql服务器包。智能交互提供多个解决冲突和依赖的解决方案。拒绝所有的波普索斯说‘不’,直到你发现降级mysql-常见于你想要的版本。

  • 重新安装mysql-server包apt install mysql-server
票数 1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1405475

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档