无法重新安装 mysql:mysql-server 依赖于 mysql-server-5.7 但是:软件包 mysql-server-5.7 尚未配置

无法重新安装 mysql:mysql-server 依赖于 mysql-server-5.7 但是:软件包 mysql-server-5.7 尚未配置

我一直在尝试在 Ubuntu 16.04 上卸载并重新安装 MySQL,我已经看到了很多方法,但我无法弄清楚为什么会收到错误。

$ sudo apt-get install mysql-server
mysql-server is already the newest version (5.7.17-0ubuntu0.16.04.2).
The following package was automatically installed and is no longer required:
  snap-confine
Use 'sudo apt autoremove' to remove it.
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] 
Setting up mysql-server-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Renaming removed key_buffer and myisam-recover options (if present)
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.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Mi 2017-04-26 12:15:04 EEST; 5ms ago
  Process: 13693 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)

apr 26 12:15:04 alex-X750JB systemd[1]: Failed to start MySQL Community Server.
apr 26 12:15:04 alex-X750JB systemd[1]: mysql.service: Unit entered failed state.
apr 26 12:15:04 alex-X750JB systemd[1]: mysql.service: Failed with result 'exit-code'.
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
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 apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get dist-upgrade
sudo apt-get install mysql-server

一切都很顺利,直到我使用sudo apt-get install mysql-server

如果我运行systemctl status mysql.service

● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: inactive (dead) (Result: exit-code) since Mi 2017-04-26 13:30:19 EEST; 11min ago
  Process: 17650 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)

apr 26 13:30:18 alex-X750JB systemd[1]: Failed to start MySQL Community Server.
apr 26 13:30:18 alex-X750JB systemd[1]: mysql.service: Unit entered failed state.
apr 26 13:30:18 alex-X750JB systemd[1]: mysql.service: Failed with result 'exit-code'.
apr 26 13:30:19 alex-X750JB systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
apr 26 13:30:19 alex-X750JB systemd[1]: Stopped MySQL Community Server.
apr 26 13:30:19 alex-X750JB systemd[1]: mysql.service: Start request repeated too quickly.
apr 26 13:30:19 alex-X750JB systemd[1]: Failed to start MySQL Community Server.

答案1

我按照这里我设法重新安装了 mysql-server 并且它运行了。

相关内容