2017-08-24 16 views
0

MySqlサーバを起動している間、このエラーが発生し続けています。 sockファイルのパスは、/var/run/mysqld/mysqld.sockです。 私はそれを他の方法で見つけようとしましたが、ファイルが見つかりませんでした。ERROR 2002(HY000):ソケット '/var/run/mysqld/mysqld.sock'(2)が発生してローカルMySQLサーバに接続できません。

systemctlステータスmysql.serviceを実行した後、出力は次の出力が生成されてしまった-XE journalctlを実行した後

● mysql.service - MySQL Community Server 
 
    Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) 
 
    Active: activating (start-post) (Result: exit-code) since Thu 2017-08-24 12:58:44 UTC; 26s ago 
 
    Process: 19985 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE) 
 
    Process: 19976 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS) 
 
Main PID: 19985 (code=exited, status=1/FAILURE);   : 19986 (mysql-systemd-s) 
 
    Tasks: 2 
 
    Memory: 328.0K 
 
     CPU: 262ms 
 
    CGroup: /system.slice/mysql.service 
 
      └─control 
 
      ├─19986 /bin/bash /usr/share/mysql/mysql-systemd-start post 
 
      └─20068 sleep 1 
 

 
Aug 24 12:58:44 ip-172-31-25-190 systemd[1]: mysql.service: Service hold-off time over, scheduling restart. 
 
Aug 24 12:58:44 ip-172-31-25-190 systemd[1]: Stopped MySQL Community Server. 
 
Aug 24 12:58:44 ip-172-31-25-190 systemd[1]: Starting MySQL Community Server... 
 
Aug 24 12:58:46 ip-172-31-25-190 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

ことが与えられています。

Aug 24 12:58:44 ip-172-31-25-190 systemd[1]: Starting MySQL Community Server... 
 
-- 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. 
 
Aug 24 12:58:44 ip-172-31-25-190 kernel: audit: type=1400 audit(1503579524.748:818): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/19985/sta 
 
Aug 24 12:58:44 ip-172-31-25-190 kernel: audit: type=1400 audit(1503579524.748:819): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/sy 
 
Aug 24 12:58:44 ip-172-31-25-190 kernel: audit: type=1400 audit(1503579524.748:820): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/19985/sta 
 
Aug 24 12:58:44 ip-172-31-25-190 audit[19985]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/19985/status" pid=19985 comm="mysqld" reque 
 
Aug 24 12:58:44 ip-172-31-25-190 audit[19985]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=19985 comm="mysqld 
 
Aug 24 12:58:44 ip-172-31-25-190 audit[19985]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/19985/status" pid=19985 comm="mysqld" reque 
 
Aug 24 12:58:46 ip-172-31-25-190 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE 
 
Aug 24 12:59:14 ip-172-31-25-190 systemd[1]: Failed to start MySQL Community Server. 
 
-- 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. 
 
Aug 24 12:59:14 ip-172-31-25-190 systemd[1]: mysql.service: Unit entered failed state. 
 
Aug 24 12:59:14 ip-172-31-25-190 systemd[1]: mysql.service: Failed with result 'exit-code'. 
 
Aug 24 12:59:14 ip-172-31-25-190 systemd[1]: mysql.service: Service hold-off time over, scheduling restart. 
 
Aug 24 12:59:14 ip-172-31-25-190 systemd[1]: Stopped MySQL Community Server. 
 
-- 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. 
 
Aug 24 12:59:14 ip-172-31-25-190 systemd[1]: Starting MySQL Community Server... 
 
-- 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. 
 
Aug 24 12:59:15 ip-172-31-25-190 kernel: audit: type=1400 audit(1503579555.004:821): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20089/sta 
 
Aug 24 12:59:15 ip-172-31-25-190 audit[20089]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20089/status" pid=20089 comm="mysqld" reque 
 
Aug 24 12:59:15 ip-172-31-25-190 audit[20089]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=20089 comm="mysqld 
 
Aug 24 12:59:15 ip-172-31-25-190 audit[20089]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20089/status" pid=20089 comm="mysqld" reque 
 
Aug 24 12:59:15 ip-172-31-25-190 kernel: audit: type=1400 audit(1503579555.012:822): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/sy 
 
Aug 24 12:59:15 ip-172-31-25-190 kernel: audit: type=1400 audit(1503579555.012:823): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/20089/sta 
 
Aug 24 12:59:16 ip-172-31-25-190 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

私は

general_log_file = /var/log/mysql/mysql.log 
 
general_log= 1 
 
log_slow_queries = /var/log/mysql/mysql-slow.log 
 
long_query_time = 1 
 
log-queries-not-using-indexes = 1
/etc/mysql/mysql.conf.d/mysqld.cnf に以下の行をコメントアウトしていたときに表示されるこのエラーコード

解決するために行うべきこと 同じ?

+0

何をすべきかは、スタートのための少しのグーグルです:https://duckduckgo.com/?q=Can't+connect+to+local+MSQL+server+through+socket&t=vivaldi&ia=qa + https: //stackoverflow.com/questions/5376427/cant-connect-to-local-mysql-server-through-socket-var-mysql-mysql-sock-38 – meta

+0

私はすでにそれを捜したが、すべての問題で彼らは正しいことを示唆しているパスはここにあるが、パスはすでに正しいので、そのファイルはそこにはなく、私もそれを見つけることはできない。 –

答えて

0

があるためAppArmorの同じ問題でこのコメントを見つけ

AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" 

のものであってもよい:https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1610765/comments/19

修正する必要があります:

にシステムリソースへのアクセスを許可するセクションを編集
# sudo nano /etc/apparmor.d/usr.sbin.mysqld 

# Allow system resource access 
/sys/devices/system/cpu/ r, 
/sys/devices/system/node/ r, 
/sys/devices/system/node/** r, 
/proc/** r, 
+0

同じエラーがまだ発生しています –

関連する問題