本地虚拟机(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
还真有/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服务顺利启动~