尚未配置mysql-server-5.7

时间:2019-11-20 18:26:56

标签: mysql

我很早以前安装了Mysql5.7,之后我卸载了它并安装了MariaDB禁用apparmor(mysql)配置文件。

现在,我卸载了MariaDB,并尝试安装mysql5.7,但出现此错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
mysql-server is already the newest version (5.7.28-0ubuntu0.18.04.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up mysql-server-5.7 (5.7.28-0ubuntu0.18.04.4) ...
/var/lib/dpkg/info/mysql-server-5.7.postinst: line 191: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-5.7 (--configure):
 installed mysql-server-5.7 package post-installation script subprocess returned error exit status 127
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
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

当我也使用sudo dpkg --configre -a时也会收到此错误。

我使用sudo apt install mysql-server安装软件包。 我尝试在线遵循一些指南,删除了/var/lib/dpkg/info/mysql-server-5.7.postinst清除了mariadb,mysql并尝试了很多东西。

4 个答案:

答案 0 :(得分:1)

这已为我修复(MySQL 8.0-Ubuntu 20.04)

sudo apt-get purge mysql\* libmysql\*
sudo apt autoremove

但是软件包“ mysql-client-core-8.0”没有卸载,所以...

sudo apt --fix-broken install
sudo apt-get --reinstall install mysql-client-core-8.0
sudo apt-get purge mysql\* libmysql\*
sudo apt autoremove
sudo apt update
sudo apt install mysql-server

没有更多错误!

答案 1 :(得分:0)

好,我是这样解决的:

  • 我使用Software & Updates应用程序删除了mariadb源
  • 并执行以下步骤(参考https://askubuntu.com/a/934576):
  • sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server
  • sudo apt update && sudo apt dist-upgrade && sudo apt autoremove && sudo apt -f install
  • sudo apt install mysql-server

答案 2 :(得分:0)

尝试一下:

sudo dpkg -P mysql-server mysql-server-5.1
sudo apt-get autoremove
sudo apt-get clean
dpkg -l | grep -i mysql
sudo rm -rvf /var/lib/mysql
sudo apt-get install mysql-server

步骤dpkg -l | grep -i mysql将向您显示所有已安装的mysql模块。在下一步之前,它应该为空。

答案 3 :(得分:0)

如果端口 (3306) 正被另一个应用程序使用,也可能发生此错误。就我而言,我有一个运行 mysql 的 docker 容器,该容器使用 3306 端口。因此我的本地 mysql 安装配置失败。

$ sudo netstat -nltp | grep LISTEN | grep 3306
$ sudo netstat -nltp | grep LISTEN | grep 3306
tcp6       0      0 :::3306                 :::*                    LISTEN      1017033/docker-prox 

sudo apt purge --auto-remove mysql*
sudo rm -r /etc/mysql
sudo rm -r /var/lib/mysql*

sudo apt install mysql-client-8.0 mysql-server-8.0 --fix-broken -y