尝试将 mysql 加载到 Ubuntu 16.04 时出错

尝试将 mysql 加载到 Ubuntu 16.04 时出错

我是 Ubuntu 新手,如果这个问题的答案很明显,我深表歉意。我尝试在论坛上搜索类似问题,但找不到解决方案。我试图将 mysql 作为 LAMP 堆栈的一部分加载以运行 Moodle。但是,我在尝试加载 mysql 时遇到错误。这是来自终端的所有信息:

sudo apt-get install apache2 mysql-client mysql-server php7.0 libapache2-mod-php7.0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
apache2 is already the newest version (2.4.18-2ubuntu3.1).
libapache2-mod-php7.0 is already the newest version (7.0.8-0ubuntu0.16.04.3).
The following package was automatically installed and is no longer required:
  gnome-video-effects
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  libevent-core-2.0-5 mysql-client-5.7 mysql-client-core-5.7 mysql-common
  mysql-server-5.7 mysql-server-core-5.7
Suggested packages:
  mailx tinyca
The following NEW packages will be installed
  libevent-core-2.0-5 mysql-client mysql-client-5.7 mysql-client-core-5.7
  mysql-common mysql-server mysql-server-5.7 mysql-server-core-5.7 php7.0
0 to upgrade, 9 to newly install, 0 to remove and 0 not to upgrade.
Need to get 10.0 kB/18.2 MB of archives.
After this operation, 160 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client all 5.7.16-0ubuntu0.16.04.1 [10.0 kB]
Fetched 10.0 kB in 0s (82.3 kB/s)       
Preconfiguring packages ...
Selecting previously unselected package libevent-core-2.0-5:amd64.
(Reading database ... 209205 files and directories currently installed.)
Preparing to unpack .../libevent-core-2.0-5_2.0.21-stable-2_amd64.deb ...
Unpacking libevent-core-2.0-5:amd64 (2.0.21-stable-2) ...
Selecting previously unselected package mysql-common.
Preparing to unpack .../mysql-common_5.7.16-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-common (5.7.16-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack .../mysql-client-core-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../mysql-client-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack .../mysql-server-core-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-common (5.7.16-0ubuntu0.16.04.1) ...
update-alternatives: error: alternative path /etc/mysql/my.cnf.fallback doesn't exist
dpkg: error processing package mysql-common (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 mysql-common
E: Sub-process /usr/bin/dpkg returned an error code (1)

随后我运行了 dist-upgrade 并收到以下消息:

sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  gnome-video-effects libevent-core-2.0-5 mysql-client-5.7
  mysql-client-core-5.7 mysql-common mysql-server-core-5.7
Use 'sudo apt autoremove' to remove them.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
5 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 libevent-core-2.0-5:amd64 (2.0.21-stable-2) ...
Setting up mysql-client-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Setting up mysql-common (5.7.16-0ubuntu0.16.04.1) ...
update-alternatives: error: alternative path /etc/mysql/my.cnf.fallback doesn't exist
dpkg: error processing package mysql-common (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of mysql-client-5.7:
 mysql-client-5.7 depends on mysql-common (>= 5.5); however:
  Package mysql-common is not configured yet.

dpkg: error processing package mysql-client-5.7 (--configure):
 dependency problems - leaving unconfigured
Setting up mysql-server-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...
No apport report written because the error message indicates it's a follow-up error from a previous failure.
                            Processing triggers for libc-bin (2.23-0ubuntu4) ...
Errors were encountered while processing:
 mysql-common
 mysql-client-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

尝试安装 mysql workbench 来运行数据库查询。安装lampp并启动它

sudo /opt/lampp/lampp start

将连接mysql。

相关内容