这是我得到的错误
Setting up mysql-server-5.7 (5.7.12-0ubuntu1.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.
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
Processing triggers for man-db (2.7.5-1) ...
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)
按照上面代码第2行的说明进行操作后,我正在
$ systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
Active: activating (start-post) (Result: exit-code) since Tue 2016-07-05 18:2
Process: 7822 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 7819 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exit
Main PID: 7822 (code=exited, status=1/FAILURE); : 7823 (mysql-systemd-s
CGroup: /system.slice/mysql.service
└─control
├─7823 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─7874 sleep 1
$ journalctl -xe
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Jul 05 18:29:59 rahul-HP-2000-Notebook-PC systemd[1]: mysql.service: Unit entere
Jul 05 18:29:59 rahul-HP-2000-Notebook-PC systemd[1]: mysql.service: Failed with
Jul 05 18:29:59 rahul-HP-2000-Notebook-PC systemd[1]: mysql.service: Service hol
Jul 05 18:29:59 rahul-HP-2000-Notebook-PC systemd[1]: Stopped MySQL Community Se
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Jul 05 18:29:59 rahul-HP-2000-Notebook-PC systemd[1]: Starting MySQL Community S
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
我尝试过多次重新安装,但它总是显示相同的错误。这个错误可能是什么原因?
答案 0 :(得分:1)
使用purge删除所有mysql包:
$ sudo apt-get remove --purge mysql*
$ sudo apt-get autoremove --purge
如果目录/ etc / mysql存在,即使执行了上述命令,也将其删除:
$ sudo rm -rf /etc/mysql
现在,首先,安装包mysql-client:
$ sudo apt-get install mysql-client
最后,在成功安装mysql-client之后安装mysql-server包:
$ sudo apt-get install mysql-server
上述命令是我发现修复mysql-server安装错误的唯一方法。
我已经尝试了以下链接中描述的所有解决方案,但它们都不起作用!
https://askubuntu.com/questions/766038/error-installing-mysql-on-ubuntu-16-04
https://askubuntu.com/questions/760724/16-04-upgrade-broke-mysql-server
https://ubuntuforums.org/showthread.php?t=2325143
https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1573279 https://askubuntu.com/questions/760724/16-04-upgrade-broke-mysql-server