软件包 mariadb-common 错误 - E: 子进程 /usr/bin/dpkg 返回错误代码 (1)

软件包 mariadb-common 错误 - E: 子进程 /usr/bin/dpkg 返回错误代码 (1)

我已经apt instal mariadb-server多次(当然每次都是 apt remove)了。现在,我无法再安装它了。我收到的错误是:

Errors were encountered while processing:
 mariadb-common
 mariadb-server-core-10.0
 mariadb-client-core-10.0
 mariadb-client-10.0

当我安装其他包时也会出现这个错误(它们成功结束,但最后我看到上述错误,但mariadb无论如何,没有安装成功)。

我已经使用过purgeautoclean并且autoremove还在apt卸载后删除了 mysql conf 文件,但都无济于事,我再也无法成功安装 mariadb-server。

现在我该怎么办?

更新

这是错误输出:

Processing triggers for man-db (2.7.5-1) ...
Setting up mariadb-server-core-10.0 (10.0.29-0ubuntu0.16.04.1) ...
Setting up mariadb-client-core-10.0 (10.0.29-0ubuntu0.16.04.1) ...
Setting up mariadb-client-10.0 (10.0.29-0ubuntu0.16.04.1) ...
Setting up mariadb-server-10.0 (10.0.29-0ubuntu0.16.04.1) ...
Installing new version of config file /etc/logrotate.d/mysql-server ...
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mariadb-server-10.0 (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because the error message indicates its a followup error from a previous failure.
                          dpkg: dependency problems prevent configuration of mariadb-server:
 mariadb-server depends on mariadb-server-10.0 (>= 10.0.29-0ubuntu0.16.04.1); however:
  Package mariadb-server-10.0 is not configured yet.

dpkg: error processing package mariadb-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mariadb-server-10.0
 mariadb-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

sudo apt purge mariadb* -y | sudo apt purge mysql* -y
sudo apt autoremove -y | sudo apt autoclean -y
sudo rm -R /usr/share/Mariad* | sudo rm -R /usr/share/Mysq*
sudo apt-get install mariadb-server
sudo apt update

答案2

相关问题: 无法在 ubuntu 16 上安装 mysql-server/client

这个答案Bidyut 为我工作。我遇到了您提到的错误中的这一部分:

dpkg: error processing package mariadb-server-10.0 (--configure):
 subprocess installed post-installation script returned error exit status 1

但我没有遇到你之前遇到的错误:

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.

我清除了属于 MySQL 和 MariaDB 的软件包。然后,我删除了/var/lib/mysql

$ sudo rm -R /var/lib/mysql

那行代码帮我解决了这个问题。然后,当我尝试安装 或mysql-servermariadb-server,它成功完成,没有错误。

抱歉,我不允许以评论的形式撰写此评论或以访客身份提出相关问题。

相关内容