系统崩溃后无法通过套接字连接到本地MySQL服务器

时间:2018-01-04 11:24:23

标签: mysql sockets

我的笔记本电脑突然因BSD而崩溃,重新启动并重新登录后,mysql导致我出现问题。

我在UBUNTU里面使用带有mysql的vagrant。

root@dev:/var/lib/mysql# service mysql start

Job for mysql.service failed because the control process exited with 
error code. See "systemctl status mysql.service" and "journalctl -xe" 
for details.

运行systemctl status mysql.service显示以下内容

* mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-01-04 11:08:55 GMT; 
14s ago
Docs: man:systemd-sysv-generator(8)
Process: 19954 ExecStart=/etc/init.d/mysql start (code=exited, 
status=1/FAILURE)

Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: 0 processes alive and 
'/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' 
resulted in
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: [61B blob data]
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: error: 'Can't connect to 
local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: Check that mysqld is 
running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]:
Jan 04 11:08:55 dev mysql[19954]:    ...fail!
Jan 04 11:08:55 dev systemd[1]: mysql.service: Control process exited, 
code=exited status=1
Jan 04 11:08:55 dev systemd[1]: Failed to start LSB: Start and stop the 
mysql database server daemon.
Jan 04 11:08:55 dev systemd[1]: mysql.service: Unit entered failed 
state.
Jan 04 11:08:55 dev systemd[1]: mysql.service: Failed with result 
'exit-code'.

运行journalctl -xe会显示以下内容

Jan 04 11:08:53 dev kernel: audit: type=1400 audit(1515064133.370:391): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20386 comm="mysqld" requested_ma
Jan 04 11:08:54 dev audit[20397]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/my.cnf" pid=20397 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jan 04 11:08:54 dev audit[20397]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20397 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 oui
Jan 04 11:08:54 dev kernel: audit: type=1400 audit(1515064134.382:392): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/my.cnf" pid=20397 comm="mysqld" requested_mask="r" denied_m
Jan 04 11:08:54 dev kernel: audit: type=1400 audit(1515064134.382:393): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20397 comm="mysqld" requested_ma
Jan 04 11:08:55 dev audit[20408]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/my.cnf" pid=20408 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jan 04 11:08:55 dev audit[20408]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20408 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 oui
Jan 04 11:08:55 dev kernel: audit: type=1400 audit(1515064135.398:394): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/my.cnf" pid=20408 comm="mysqld" requested_mask="r" denied_m
Jan 04 11:08:55 dev kernel: audit: type=1400 audit(1515064135.398:395): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20408 comm="mysqld" requested_ma
Jan 04 11:08:55 dev audit[20418]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/my.cnf" pid=20418 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jan 04 11:08:55 dev audit[20418]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20418 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 oui
Jan 04 11:08:55 dev kernel: audit: type=1400 audit(1515064135.410:396): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/my.cnf" pid=20418 comm="mysqld" requested_mask="r" denied_m
Jan 04 11:08:55 dev kernel: audit: type=1400 audit(1515064135.410:397): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=20418 comm="mysqld" requested_ma
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: [61B blob data]
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Jan 04 11:08:55 dev /etc/init.d/mysql[20425]:
Jan 04 11:08:55 dev mysql[19954]:    ...fail!
Jan 04 11:08:55 dev systemd[1]: mysql.service: Control process exited, code=exited status=1
Jan 04 11:08:55 dev systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
-- 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.
Jan 04 11:08:55 dev systemd[1]: mysql.service: Unit entered failed state.
Jan 04 11:08:55 dev systemd[1]: mysql.service: Failed with result 'exit-code'.
Jan 04 11:09:01 dev CRON[20427]: pam_unix(cron:session): session opened for user root by (uid=0)
Jan 04 11:09:01 dev CRON[20428]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jan 04 11:09:01 dev CRON[20427]: pam_unix(cron:session): session closed for user root
Jan 04 11:09:02 dev systemd[1]: Starting Clean php session files...
-- Subject: Unit phpsessionclean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit phpsessionclean.service has begun starting up.
Jan 04 11:09:02 dev sessionclean[20429]: Cannot load Xdebug - it was already loaded
Jan 04 11:09:02 dev sessionclean[20429]: Cannot load Xdebug - it was already loaded
Jan 04 11:09:02 dev sessionclean[20429]: Cannot load Xdebug - it was already loaded
Jan 04 11:09:02 dev systemd[1]: Started Clean php session files.
-- Subject: Unit phpsessionclean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit phpsessionclean.service has finished starting up.
--
-- The start-up result is done.

我看不到任何mysqld.sock文件,我试图以安全模式启动恢复选项等但我没有成功。非常感谢任何帮助。

0 个答案:

没有答案