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.

状态

➜ 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.

权限没问题

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

内存

➜ 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.

系统 Centos7
mysql 8.0.12

阅读 4k
3 个回答

有权限,内存够吧

排查下
1.内存是否不足
2.读写权限是否够

mysql.sock 是mysql服务启动以后才会有的临时文件。
请参考。
1.检查mysql服务启动是否正常
2.查看/ect/my.cnf 看报错日志的路径,查看日志
3.重新初始化mysql数据库。


安装方式是什么 yum 还是 源码
/etc/my.cnf 配置检查一下。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题