MySql教程

Starting MySQL ** mysqld_safe Directory '/var/lib/mysql' for UNIX socket file don't e

本文主要是介绍Starting MySQL ** mysqld_safe Directory '/var/lib/mysql' for UNIX socket file don't e,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

本地虚拟机(CentOS6.8)启动MySQL(MySQL5.6.35)服务失败

[root@VMUest ~]# service mysql status
 ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
[root@VMUest ~]# rm -f /var/lock/subsys/mysql
[root@VMUest ~]# service mysql status
 ERROR! MySQL is not running
[root@VMUest ~]# service mysql start
Starting MySQL.170331 10:18:30 mysqld_safe Directory '/var/lib/mysql' for UNIX socket file don't exists.
 ERROR! The server quit without updating PID file (/usr/local/mysql/data/VMUest.pid).

前一天就折腾了mysqlsla,今天MySQL就启动不了。参考修改CentOS6.5主机名引起MySQL5.6.35服务问题里面的方法没有效果。各种纠结都没用,最后想起启动MySQL服务时,会优先在/etc/目录下查找my.cnf

[root@VMUest ~]# ll /etc/my.cnf
-rw-r--r--. 1 root root 251 Jan 27 05:41 /etc/my.cnf
[root@VMUest ~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@VMUest ~]# ll /etc/ |grep my
-rw-r--r--.  1 root root    251 Jan 27 05:41 my.cnf
[root@VMUest ~]# mv /etc/my.cnf /etc/my.cnf.bak

还真有/etc/my.cnf,里面设置有socket=/var/lib/mysql/mysql.sock。我是使用源码在虚拟机上安装的MySQL,安装目录为/usr/local/mysql/,相关配置文件都保存在此目录。并且有检查/etc/my.cnf文件是否存在(存在就将其重命名/删除)。怎么又冒出来了?是折腾mysqlsla时出来的?

[root@VMUest ~]# service mysql start
Starting MySQL........................................................... SUCCESS! 

把/etc/my.cnf重命名后,MySQL服务顺利启动~

转载于:https://www.cnblogs.com/ShanFish/p/6652174.html

这篇关于Starting MySQL ** mysqld_safe Directory '/var/lib/mysql' for UNIX socket file don't e的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!