我正在尝试在 Ubuntu 18.04 上安装 MySQL。为此,我首先使用以下命令下载软件包:
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb
然后,运行命令:
sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb
但我遇到了依赖项问题,并且我不知道这些依赖项是什么。这是我收到的消息的一部分:
Configuring mysql-community-server (8.0.15-1ubuntu18.04) ...
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
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: failed (Result: exit-code) since Tue 2019-03-12 01:06:40 CET; 17ms ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 12302 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 12263 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 12302 (code=exited, status=1/FAILURE)
Status: "SERVER_BOOTING"
mar 12 01:06:39 R2D2 systemd[1]: Starting MySQL Community Server...
mar 12 01:06:40 R2D2 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
mar 12 01:06:40 R2D2 systemd[1]: mysql.service: Failed with result 'exit-code'.
mar 12 01:06:40 R2D2 systemd[1]: Failed to start MySQL Community Server.
dpkg: error processing package mysql-community-server (--configure):
installed mysql-community-server package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-community-server (= 8.0.15-1ubuntu18.04); however:
Package mysql-community-server is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of mysql-community-server-dbgsym:
mysql-community-server-dbgsym depends on mysql-community-server (= 8.0.15-1ubuntu18.04); however:
Package mysql-community-server is not configured yet.
dpkg: error processing package mysql-community-server-dbgsym (--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-community-server
mysql-server
mysql-community-server-dbgsym
E: Sub-process /usr/bin/dpkg returned an error code (1)
这是我咨询的日志journalctl -xe
:
josecarlos@R2D2:~/Descargas$ journalctl -xe
mar 12 01:35:01 R2D2 CRON[13062]: pam_unix(cron:session): session closed for user root
mar 12 01:36:01 R2D2 org.gnome.Shell.desktop[1874]: (/usr/lib/firefox/firefox:10916): dconf-WARNING **: 01:36:01.2
mar 12 01:36:39 R2D2 sudo[13085]: josecarlos : TTY=pts/0 ; PWD=/home/josecarlos/Descargas ; USER=root ; COMMAND=/u
mar 12 01:36:39 R2D2 sudo[13085]: pam_unix(sudo:session): session opened for user root by (uid=0)
mar 12 01:36:40 R2D2 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has begun starting up.
mar 12 01:36:40 R2D2 audit[13150]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile
mar 12 01:36:40 R2D2 kernel: audit: type=1400 audit(1552351000.784:89): apparmor="STATUS" operation="profile_repla
mar 12 01:36:41 R2D2 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
mar 12 01:36:41 R2D2 systemd[1]: mysql.service: Failed with result 'exit-code'.
mar 12 01:36:41 R2D2 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit mysql.service has failed.
--
-- The result is RESULT.
mar 12 01:36:41 R2D2 sudo[13085]: pam_unix(sudo:session): session closed for user root
输出sudo apt update && sudo apt upgrade
:
Hit:1 http://es.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://repo.mysql.com/apt/ubuntu bionic InRelease
Hit:3 http://archive.canonical.com/ubuntu bionic InRelease
Hit:4 https://deb.nodesource.com/node_11.x bionic InRelease
Hit:5 http://packages.microsoft.com/repos/vscode stable InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 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-community-server (8.0.15-1ubuntu18.04) ...
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
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: failed (Result: exit-code) since Tue 2019-03-12 12:17:46 CET; 8ms ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 8839 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 8800 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 8839 (code=exited, status=1/FAILURE)
Status: "SERVER_BOOTING"
mar 12 12:17:45 R2D2 systemd[1]: Starting MySQL Community Server...
mar 12 12:17:46 R2D2 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
mar 12 12:17:46 R2D2 systemd[1]: mysql.service: Failed with result 'exit-code'.
mar 12 12:17:46 R2D2 systemd[1]: Failed to start MySQL Community Server.
dpkg: error processing package mysql-community-server (--configure):
installed mysql-community-server package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-community-server (= 8.0.15-1ubuntu18.04); however:
Package mysql-community-server is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of mysql-community-server-dbgsym:
mysql-community-server-dbgsym depends on mysql-community-server (= 8.0.15-1ubuntu18.04); however:
Package mysql-community-server is not configured yet.
dpkg: error processing package mysql-community-server-dbgsym (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-community-server
mysql-server
mysql-community-server-dbgsym
E: Sub-process /usr/bin/dpkg returned an error code (1)
我犯了一个很大的错误,那就是我之前在我的笔记本电脑上安装了 mysql-server-5.5。我已删除并清除所有内容并再次重新安装,但它不起作用。
该命令的日志sudo apt install mysql-server
是:
josecarlos@R2D2:~$ LANG=C sudo apt install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-server
mysql-community-server-core
The following NEW packages will be installed:
libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-server
mysql-community-server-core mysql-server
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Need to get 58,3 MB of archives.
After this operation, 418 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://es.archive.ubuntu.com/ubuntu bionic/universe amd64 libmecab2 amd64 0.996-5 [257 kB]
Get:2 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-common amd64 8.0.15-1ubuntu18.04 [84,4 kB]
Get:3 http://es.archive.ubuntu.com/ubuntu bionic/universe amd64 mecab-utils amd64 0.996-5 [4.856 B]
Get:4 http://es.archive.ubuntu.com/ubuntu bionic/universe amd64 mecab-ipadic all 2.7.0-20070801+main-1 [12,1 MB]
Get:5 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client-core amd64 8.0.15-1ubuntu18.04 [1.450 kB]
Get:6 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.15-1ubuntu18.04 [2.310 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-client amd64 8.0.15-1ubuntu18.04 [81,0 kB]
Get:8 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.15-1ubuntu18.04 [17,6 MB]
Get:9 http://es.archive.ubuntu.com/ubuntu bionic/universe amd64 mecab-ipadic-utf8 all 2.7.0-20070801+main-1 [3.522 B]
Get:10 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server amd64 8.0.15-1ubuntu18.04 [24,2 MB]
Get:11 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-server amd64 8.0.15-1ubuntu18.04 [81,0 kB]
Fetched 58,3 MB in 2s (30,7 MB/s)
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 821063 files and directories currently installed.)
Preparing to unpack .../00-mysql-common_8.0.15-1ubuntu18.04_amd64.deb ...
Unpacking mysql-common (8.0.15-1ubuntu18.04) ...
Selecting previously unselected package mysql-community-client-core.
Preparing to unpack .../01-mysql-community-client-core_8.0.15-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-client-core (8.0.15-1ubuntu18.04) ...
Selecting previously unselected package mysql-community-client.
Preparing to unpack .../02-mysql-community-client_8.0.15-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-client (8.0.15-1ubuntu18.04) ...
Selecting previously unselected package mysql-client.
Preparing to unpack .../03-mysql-client_8.0.15-1ubuntu18.04_amd64.deb ...
Unpacking mysql-client (8.0.15-1ubuntu18.04) ...
Selecting previously unselected package libmecab2:amd64.
Preparing to unpack .../04-libmecab2_0.996-5_amd64.deb ...
Unpacking libmecab2:amd64 (0.996-5) ...
Selecting previously unselected package mysql-community-server-core.
Preparing to unpack .../05-mysql-community-server-core_8.0.15-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-server-core (8.0.15-1ubuntu18.04) ...
Selecting previously unselected package mysql-community-server.
Preparing to unpack .../06-mysql-community-server_8.0.15-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-server (8.0.15-1ubuntu18.04) ...
Selecting previously unselected package mecab-utils.
Preparing to unpack .../07-mecab-utils_0.996-5_amd64.deb ...
Unpacking mecab-utils (0.996-5) ...
Selecting previously unselected package mecab-ipadic.
Preparing to unpack .../08-mecab-ipadic_2.7.0-20070801+main-1_all.deb ...
Unpacking mecab-ipadic (2.7.0-20070801+main-1) ...
Selecting previously unselected package mecab-ipadic-utf8.
Preparing to unpack .../09-mecab-ipadic-utf8_2.7.0-20070801+main-1_all.deb ...
Unpacking mecab-ipadic-utf8 (2.7.0-20070801+main-1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../10-mysql-server_8.0.15-1ubuntu18.04_amd64.deb ...
Unpacking mysql-server (8.0.15-1ubuntu18.04) ...
Setting up mysql-common (8.0.15-1ubuntu18.04) ...
Setting up libmecab2:amd64 (0.996-5) ...
Setting up mysql-community-client-core (8.0.15-1ubuntu18.04) ...
Setting up mysql-community-server-core (8.0.15-1ubuntu18.04) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2) ...
Setting up mecab-utils (0.996-5) ...
Setting up mysql-community-client (8.0.15-1ubuntu18.04) ...
Setting up mecab-ipadic (2.7.0-20070801+main-1) ...
Compiling IPA dictionary for Mecab. This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################|
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
reading /usr/share/mecab/dic/ipadic/Interjection.csv ... 252
reading /usr/share/mecab/dic/ipadic/Adj.csv ... 27210
reading /usr/share/mecab/dic/ipadic/Noun.others.csv ... 151
reading /usr/share/mecab/dic/ipadic/Others.csv ... 2
reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
reading /usr/share/mecab/dic/ipadic/Suffix.csv ... 1393
reading /usr/share/mecab/dic/ipadic/Noun.proper.csv ... 27327
reading /usr/share/mecab/dic/ipadic/Adverb.csv ... 3032
reading /usr/share/mecab/dic/ipadic/Noun.demonst.csv ... 120
reading /usr/share/mecab/dic/ipadic/Filler.csv ... 19
reading /usr/share/mecab/dic/ipadic/Noun.adverbal.csv ... 795
reading /usr/share/mecab/dic/ipadic/Symbol.csv ... 208
reading /usr/share/mecab/dic/ipadic/Postp.csv ... 146
reading /usr/share/mecab/dic/ipadic/Conjunction.csv ... 171
reading /usr/share/mecab/dic/ipadic/Noun.name.csv ... 34202
reading /usr/share/mecab/dic/ipadic/Noun.csv ... 60477
reading /usr/share/mecab/dic/ipadic/Noun.verbal.csv ... 12146
reading /usr/share/mecab/dic/ipadic/Noun.adjv.csv ... 3328
reading /usr/share/mecab/dic/ipadic/Prefix.csv ... 221
reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135
reading /usr/share/mecab/dic/ipadic/Auxil.csv ... 199
reading /usr/share/mecab/dic/ipadic/Noun.number.csv ... 42
reading /usr/share/mecab/dic/ipadic/Noun.org.csv ... 16668
reading /usr/share/mecab/dic/ipadic/Verb.csv ... 130750
reading /usr/share/mecab/dic/ipadic/Postp-col.csv ... 91
emitting double-array: 100% |###########################################|
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix : 100% |###########################################|
done!
update-alternatives: using /var/lib/mecab/dic/ipadic to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up mysql-client (8.0.15-1ubuntu18.04) ...
Setting up mecab-ipadic-utf8 (2.7.0-20070801+main-1) ...
Compiling IPA dictionary for Mecab. This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################|
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
reading /usr/share/mecab/dic/ipadic/Interjection.csv ... 252
reading /usr/share/mecab/dic/ipadic/Adj.csv ... 27210
reading /usr/share/mecab/dic/ipadic/Noun.others.csv ... 151
reading /usr/share/mecab/dic/ipadic/Others.csv ... 2
reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
reading /usr/share/mecab/dic/ipadic/Suffix.csv ... 1393
reading /usr/share/mecab/dic/ipadic/Noun.proper.csv ... 27327
reading /usr/share/mecab/dic/ipadic/Adverb.csv ... 3032
reading /usr/share/mecab/dic/ipadic/Noun.demonst.csv ... 120
reading /usr/share/mecab/dic/ipadic/Filler.csv ... 19
reading /usr/share/mecab/dic/ipadic/Noun.adverbal.csv ... 795
reading /usr/share/mecab/dic/ipadic/Symbol.csv ... 208
reading /usr/share/mecab/dic/ipadic/Postp.csv ... 146
reading /usr/share/mecab/dic/ipadic/Conjunction.csv ... 171
reading /usr/share/mecab/dic/ipadic/Noun.name.csv ... 34202
reading /usr/share/mecab/dic/ipadic/Noun.csv ... 60477
reading /usr/share/mecab/dic/ipadic/Noun.verbal.csv ... 12146
reading /usr/share/mecab/dic/ipadic/Noun.adjv.csv ... 3328
reading /usr/share/mecab/dic/ipadic/Prefix.csv ... 221
reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135
reading /usr/share/mecab/dic/ipadic/Auxil.csv ... 199
reading /usr/share/mecab/dic/ipadic/Noun.number.csv ... 42
reading /usr/share/mecab/dic/ipadic/Noun.org.csv ... 16668
reading /usr/share/mecab/dic/ipadic/Verb.csv ... 130750
reading /usr/share/mecab/dic/ipadic/Postp-col.csv ... 91
emitting double-array: 100% |###########################################|
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix : 100% |###########################################|
done!
update-alternatives: using /var/lib/mecab/dic/ipadic-utf8 to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up mysql-community-server (8.0.15-1ubuntu18.04) ...
dpkg: error processing package mysql-community-server (--configure):
installed mysql-community-server package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-community-server (= 8.0.15-1ubuntu18.04); however:
Package mysql-community-server 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-community-server
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
现在,这些是我的笔记本电脑中安装的 mysql-server 包:
我不知道我现在做错了什么。
答案1
这为我解决了这个问题(MySQL 8.0 - Ubuntu 20.04)
sudo apt-get purge mysql\* libmysql\*
sudo apt autoremove
但包裹“mysql-客户端-核心-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
不再有错误!
答案2
我在这里看到两个问题。
3 not fully installed or removed
错误。当你跑的时候sudo apt update && sudo apt upgrade
。这意味着这些包已损坏。您需要强制删除它们。跑步sudo apt-get autoclean && sudo apt-get --force-yes remove mysql-community-server-dbgsym mysql-community-server mysql-server
现在MySQL无法启动的问题。您似乎已经从 14.04 升级,留下了一些过时的软件包,例如 libmysqlclient18。 (Bionic (18.04) 有 libmysqlclient20)
删除所有与 MySQL 相关的软件包并执行 MySQL 的“全新安装”。跑步
sudo apt remove --purge libapache2-mod-auth-mysql libmysqlclient18:i386 libmysqlclient18:amd64 mysql-common mysql-community-client mysql-community-client-core mysql-community-server mysql-community-server-core mysql-server
再次安装MySQL,
sudo apt install mysql-server
进一步阅读:
答案3
我遇到了类似的问题,并尝试安装/卸载/重新安装许多不同的软件包,结果却反复收到相同的错误消息。
最后,安装下面的 MariaDB 包(其中包含许多相同的 mysql 依赖项)解决了我的问题。
sudo apt install mariadb-client-core-10.3