(Mysql启动异常) The server quit without updating PID file

Question

在Linux服器上启动mysql, service mysql start,爆出如下错误:

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

这个问题有多个原因造成的,所以我们需要在/etc/my.cnf 文件上查看mysql的错误log的位置。

我的是log-error=/data/log/mysql/mysql_error.log

查看log,发现错误的内容如下:

2018-01-04T05:28:56.992027Z mysqld_safe mysqld from pid file /data/mysql/rhel6.5-server.pid ended
2018-01-04T06:09:26.047382Z mysqld_safe Starting mysqld daemon with databases from /data/mysql
2018-01-04T06:09:26.593691Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-01-04T06:09:26.593802Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2018-01-04T06:09:26.593847Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.12) starting as process 1751 ...
2018-01-04T06:09:26.753125Z 0 [Note] InnoDB: PUNCH HOLE support not available
2018-01-04T06:09:26.753168Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-01-04T06:09:26.753177Z 0 [Note] InnoDB: Uses event mutexes
2018-01-04T06:09:26.753186Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2018-01-04T06:09:26.753193Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-01-04T06:09:26.753200Z 0 [Note] InnoDB: Using Linux native AIO
2018-01-04T06:09:26.753490Z 0 [Note] InnoDB: Number of pools: 1
2018-01-04T06:09:26.755357Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysqld: Can't create/write to file '/tmp/ibfIVykW' (Errcode: 13 - Permission denied)
2018-01-04T06:09:26.755445Z 0 [ERROR] InnoDB: Unable to create temporary file; errno: 13
2018-01-04T06:09:26.755456Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-01-04T06:09:26.755471Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-01-04T06:09:26.755486Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-01-04T06:09:26.755506Z 0 [ERROR] Failed to initialize plugins.
2018-01-04T06:09:26.755513Z 0 [ERROR] Aborting

2018-01-04T06:09:26.756291Z 0 [Note] Binlog end
2018-01-04T06:09:26.758738Z 0 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

2018-01-04T06:09:26.765393Z mysqld_safe mysqld from pid file /data/mysql/rhel6.5-server.pid ended

Solution

不能创建临时文件导致无法启动,错误日志:mysqld: Can’t create/write to file ‘/tmp/ibfguTtC’ (Errcode: 13)

MySQL 启动失败,错误日志:mysqld: Can’t create/write to file ‘/tmp/ibfguTtC’ (Errcode: 13)

说明/tmp目录无法写入

1、使用命令 ll -d /tmp 命令检查目录权限

2、使用 chmod 1777 /tmp 设置为正确权限

再测试可以启动成功


Reference

[1]. (阿里云)ECS Linux MySQL 常见无法启动或启动异常的解决方案

[2]. (CSDN)MySql启动出现The server quit without updating PID file错误解决过程

你可能感兴趣的:(4.,异常,-------4.2.,mysql异常)