鍍金池/ 問答/Linux  數(shù)據(jù)庫/ mysql sock 找不到

mysql sock 找不到

問題描述

啟動時報錯

? mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'(2)

其他目錄沒有 sock文件

? find / -name "*.sock"
/run/chrony/chronyd.sock

啟動失敗

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

狀態(tài)

? systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since 三 2018-09-05 17:18:01 CST; 4min 6s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 5105 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
  Process: 5082 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 5105 (code=exited, status=1/FAILURE)
   Status: "SERVER_BOOTING"
    Error: 2 (沒有那個文件或目錄)

9月 05 17:17:58 ssr.sagiri.me systemd[1]: Starting MySQL Server...
9月 05 17:18:01 ssr.sagiri.me systemd[1]: mysqld.service: main process exited, code=exited, stat...LURE
9月 05 17:18:01 ssr.sagiri.me systemd[1]: Failed to start MySQL Server.
9月 05 17:18:01 ssr.sagiri.me systemd[1]: Unit mysqld.service entered failed state.
9月 05 17:18:01 ssr.sagiri.me systemd[1]: mysqld.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

權(quán)限沒問題

? ll /var/lib/mysql -d
drwxr-x--x 5 mysql mysql 4.0K 9月 5 17:18 /var/lib/mysql

內(nèi)存

? free -h
          total        used        free      shared  buff/cache   available

Mem: 487M 115M 224M 30M 147M 317M
Swap: 0B 0B 0B

mysql日志文件

2018-09-04T05:05:02.255889Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.12) starting as process 8174
2018-09-04T05:05:02.306416Z 0 [ERROR] [MY-012681] [InnoDB] InnoDB: mmap(137428992 bytes) failed; errno 12
2018-09-04T05:05:02.306595Z 1 [ERROR] [MY-012956] [InnoDB] InnoDB: Cannot allocate memory for the buffer pool
2018-09-04T05:05:02.306645Z 1 [ERROR] [MY-012930] [InnoDB] InnoDB: Plugin initialization aborted with error Generic error.
2018-09-04T05:05:02.306770Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2018-09-04T05:05:02.307077Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2018-09-04T05:05:02.307169Z 0 [ERROR] [MY-010119] [Server] Aborting
2018-09-04T05:05:02.310529Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.12)  MySQL Community Server - GPL.

系統(tǒng) Centos7
mysql 8.0.12

回答
編輯回答
寫榮

mysql.sock 是mysql服務(wù)啟動以后才會有的臨時文件。
請參考。
1.檢查mysql服務(wù)啟動是否正常
2.查看/ect/my.cnf 看報錯日志的路徑,查看日志
3.重新初始化mysql數(shù)據(jù)庫。


安裝方式是什么 yum 還是 源碼
/etc/my.cnf 配置檢查一下。

2017年8月14日 00:05
編輯回答
詆毀你

排查下
1.內(nèi)存是否不足
2.讀寫權(quán)限是否夠

2017年8月30日 12:53
編輯回答
厭遇

有權(quán)限,內(nèi)存夠吧

2017年6月8日 20:40