mysql-server-8.0 冲突,由于与“自身”冲突而无法安装

mysql-server-8.0 冲突,由于与“自身”冲突而无法安装

---我已经尝试过(两次)--- mariadb 失败后安装 mysql-server mariadb 不是问题,因为虽然它已安装在这台计算机上,但所有依赖项都已被删除,如下所示。终端捕获如下 https://pastebin.ubuntu.com/p/9pPQDbFzYf/情况可能类似,但情况却不同。

我已经删除了 synaptic 中的 Libmysqlclient21,因为它似乎已损坏,尝试成功卸载 synaptic 上的 MySQL,然后重新安装 synaptic不成功,显然有一个我找不到的正在运行的 MySQL 进程,这阻止了 mysql-server-8.0 的安装(mysql-client、client-8.0、client-core-8.0、server 和 server-core-8.0 重新安装就可以了)。接下来你会发现 ubuntu 终端捕获正在清理https://pastebin.ubuntu.com/p/pJCxYm5K2w/,以及突触屏幕截图显示与“自身”冲突,ps aux 报告没有正在运行的 mysql 实例,

mysql 服务器冲突

Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 220062 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.8+1.0.5ubuntu2_all.deb ...
Unpacking mysql-common (5.8+1.0.5ubuntu2) ...
Selecting previously unselected package mysql-client-core-8.0.
Preparing to unpack .../mysql-client-core-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb ...
Unpacking mysql-client-core-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Selecting previously unselected package mysql-client-8.0.
Preparing to unpack .../mysql-client-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb ...
Unpacking mysql-client-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Selecting previously unselected package mysql-server-core-8.0.
Preparing to unpack .../mysql-server-core-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb ...
Unpacking mysql-server-core-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Setting up mysql-common (5.8+1.0.5ubuntu2) ...
update-alternatives: warning: alternative /etc/mysql/mysql.cnf (part of link group my.cnf) doesn't exist; removing from list of alternatives
update-alternatives: warning: /etc/alternatives/my.cnf is dangling; it will be updated with best choice
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-8.0.
(Reading database ... 220262 files and directories currently installed.)
Preparing to unpack .../mysql-server-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
invoke-rc.d returned 5
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: error processing archive /var/cache/apt/archives/mysql-server-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb (--unpack):
 new mysql-server-8.0 package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up mysql-client-core-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Setting up mysql-server-core-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Setting up mysql-client-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9) ...

在 synaptic 上重新安装的输出

Preconfiguring packages ...
(Reading database ... 221833 files and directories currently installed.)
Preparing to unpack .../mysql-server-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
invoke-rc.d returned 5
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: error processing archive /var/cache/apt/archives/mysql-server-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb (--unpack):
 new mysql-server-8.0 package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 is not installed.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server

第二次重新安装尝试

Preconfiguring packages ...  
Selecting previously unselected package mysql-common.  
(Reading database ... 220062 files and directories currently installed.) 
Preparing to unpack .../mysql-common_5.8+1.0.5ubuntu2_all.deb ... 
Unpacking mysql-common (5.8+1.0.5ubuntu2) ...  
Selecting previously unselected package mysql-client-core-8.0.  
Preparing to unpack .../mysql-client-core-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb ...  
Unpacking mysql-client-core-8.0 (8.0.20-0ubuntu0.20.04.1) ...  
Selecting previously unselected package mysql-client-8.0.  
Preparing to unpack .../mysql-client-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb ...  
Unpacking mysql-client-8.0 (8.0.20-0ubuntu0.20.04.1) ...  
Selecting previously unselected package mysql-server-core-8.0.  
Preparing to unpack .../mysql-server-core-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb ...  
Unpacking mysql-server-core-8.0 (8.0.20-0ubuntu0.20.04.1) ...  
Setting up mysql-common (5.8+1.0.5ubuntu2) ...  
update-alternatives: warning: alternative /etc/mysql/mysql.cnf (part of link group my.cnf) doesn't exist;   
  removing from list of alternatives
update-alternatives: warning: /etc/alternatives/my.cnf is dangling; it will be updated with best choice  
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode  
Selecting previously unselected package mysql-server-8.0.  
(Reading database ... 220262 files and directories currently installed.)  
Preparing to unpack .../mysql-server-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb ...  
Failed to stop mysql.service: Unit mysql.service not loaded.  
invoke-rc.d: initscript mysql, action "stop" failed.  
invoke-rc.d returned 5  
There is a MySQL server running, but we failed in our attempts to stop it.  
Stop it yourself and try again!  
dpkg: error processing archive /var/cache/apt/archives/mysql-server-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb (--unpack):  
 new mysql-server-8.0 package pre-installation script subprocess returned error exit status 1  
Errors were encountered while processing:  
 /var/cache/apt/archives/mysql-server-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb  
E: Sub-process /usr/bin/dpkg returned an error code (1)  
A package failed to install.  Trying to recover:  
Setting up mysql-client-core-8.0 (8.0.20-0ubuntu0.20.04.1) ...  
Setting up mysql-server-core-8.0 (8.0.20-0ubuntu0.20.04.1) ...  
Setting up mysql-client-8.0 (8.0.20-0ubuntu0.20.04.1) ...  
Processing triggers for man-db (2.9.1-1) ...  
Processing triggers for libc-bin (2.31-0ubuntu9) ...  

辅助命令输出,没有与 MySQL 相关的正在运行的进程(据我所知) https://pastebin.ubuntu.com/p/z4cCYXBykW/

万分感谢

答案1

以防万一有人遇到同样的情况,这是需要考虑的事情。我不明白发生了什么,我通过具有完全管理权限的用户帐户远程访问 ubuntu 机器,但这不是安装 ubuntu 时创建的帐户,现在我终于直接访问了计算机并使用原始帐户登录,令我惊讶的是,当我尝试通过 synaptic 卸载所有 MySQL 时,我根本没有收到任何警告或错误,只是为了安全起见,我运行了以下命令

# sudo apt-get remove --purge mysql-server mysql-client mysql-common -y
# sudo apt-get autoremove -y
# rm -rf /etc/mysql
# sudo find / -iname 'mysql*' -exec rm -rf {} \;
# apt --fix-broken install

没有任何错误或警告,因此我启动了 synaptic 并重新安装了 mysql-server(synaptic 负责处理依赖项),安装正确完成。这对我来说毫无意义,因为具有完全管理权限的用户帐户应该具有完全访问权限,但事实就是如此,MySQL 已安装并正在运行。

相关内容