环境说明
Centos6.5
mysql 5.5.37
问题描述
查看mysql服务,提示mysql没有启动,手动启动后,提示如下:
[root@LNMP ~]# /etc/init.d/mysql start
Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/var/LNMP.pid).
查看错误日志
root@LNMP var]# tail -f /usr/local/mysql/var/LNMP.err
/usr/local/mysql/bin/mysqld: Can't create/write to file '/tmp/ibJb9vcs' (Errcode: 13)
161201 8:45:41 InnoDB: Error: unable to create temporary file; errno: 13
161201 8:45:41 [ERROR] Plugin 'InnoDB' init function returned error.
161201 8:45:41 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
161201 8:45:41 [ERROR] Unknown/unsupported storage engine: InnoDB
161201 8:45:41 [ERROR] Aborting
161201 8:45:41 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
161201 08:45:41 mysqld_safe mysqld from pid file /usr/local/mysql/var/LNMP.pid ended
解决办法
给临时文件加777权限
root@LNMP var]# chmod 777 /tmp
再次启动mysql,mysql正常启动!
[root@LNMP var]# /etc/init.d/mysql restart
ERROR! MySQL server PID file could not be found!
Starting MySQL.. SUCCESS!
[root@LNMP var]# ps -ef | grep mysql
root 5305 1 0 08:49 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/var --pid-file=/usr/local/mysql/var/LNMP.pid
mysql 5690 5305 1 08:49 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/var/LNMP.err --pid-file=/usr/local/mysql/var/LNMP.pid --socket=/tmp/mysql.sock --port=3306
root 5712 1969 0 08:49 pts/0 00:00:00 grep mysql