无法在 Ubuntu 18.04 上安装 mysql-server

无法在 Ubuntu 18.04 上安装 mysql-server

我无法mysql-server在我的 Ubuntu 18.04 VPS 上安装。我已经sudo apt-get update && sudo apt-get upgrade多次清除了所有 mysql 包。运行sudo apt-get install mysql-server结果如下,

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  mysql-server-5.7
Suggested packages:
  mailx tinyca
The following NEW packages will be installed:
  mysql-server mysql-server-5.7
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2939 kB of archives.
After this operation, 47.6 MB of additional disk space will be used.
Do you want to continue? [Y/n]
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 29273 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.30-0ubuntu0.18.04.1_amd64.deb ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
Unpacking mysql-server-5.7 (5.7.30-0ubuntu0.18.04.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.30-0ubuntu0.18.04.1_all.deb ...
Unpacking mysql-server (5.7.30-0ubuntu0.18.04.1) ...
Setting up mysql-server-5.7 (5.7.30-0ubuntu0.18.04.1) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
update-alternatives: warning: alternative /etc/mysql/my.cnf.fallback (part of link group my.cnf) doesn't exist; removing from list of alternatives
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
Initialization of mysqld failed: 0
Warning: Unable to start the server.
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
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 Tue 2020-06-16 22:16:32 UTC; 48ms ago
  Process: 20084 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
  Process: 20075 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)

Jun 16 22:16:32 us-ny-256 systemd[1]: Failed to start MySQL Community Server.
dpkg: error processing package mysql-server-5.7 (--configure):
 installed mysql-server-5.7 package post-installation script subprocess 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
Processing triggers for systemd (237-3ubuntu10.41) ...
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

我不知道如何修复此问题,因为我已经浏览了多个 StackExchange 网站主题,所有主题都说要清除和删除MySQL文件,但我仍然收到相同的错误。任何帮助都非常感谢。

答案1

本生:

尝试使用以下命令:

sudo apt-get clean && sudo apt-get purge mysql*
sudo apt-get update
sudo apt-get install -f && sudo apt-get install mysql-server
  • clean:清除已检索到的包文件的本地存储库。
  • 对于需要删除的内容,请使用 purge 而不是 remove。
  • -f:尝试纠正存在破坏依赖关系的系统

相关内容