MySQL错误Another MySQL daemon already running with the same unix socket.

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

   安装Cacti的过程中配置了数据库,但由于是在虚拟机里做的,习惯性的关机直接是Force off硬关机,刚配置完的cacti在我非正常关机重起后出现了问题,问题如下:


[root@server2 ~]# /etc/init.d/mysqld start
Another MySQL daemon already running with the same unix socket.
Starting mysqld:                                           [FAILED]


重点在这一句:Another MySQL daemon already running with the same unix socket.

    

    查阅了不少资料,终于找到了答案,原因是,在mysql安装目录里有一个mysql.sock文件。这个文件在mysql启动时创建的,mysql关闭时删除。那如果是非正常关机,mysql就没有机会去删除之个文件。当这个文件还存在时,mysql就启动不了,提示上面的错误。

    

两个方法解决:

    第一个是立即关机 使用命令 shutdown -h now 关机,关机后在启动,进程就停止了。

    第二个直接把mysql.sock文件改名即可。也可以删除,推荐改名。然后就可以启动mysql了


下面是国外原文


To prevent the problem from occurring, you must perform a graceful shutdown of the server from the command line rather than powering off the server.

shutdown -h now


This will stop the running services before powering down the machine.

Based on Centos, an additional method for getting it back up again when you run into this problem is to move mysql.sock:

# mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak

# service mysqld start

Restarting the service creates a new entry called mqsql.sock


本文转自willis_sun 51CTO博客,原文链接:http://blog.51cto.com/willis/1865685,如需转载请自行联系原作者

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
1月前
|
监控 安全 Unix
UNIX域套接字(Unix Domain Socket)在安全性和隐私性
UNIX域套接字(Unix Domain Socket)在安全性和隐私性
46 2
|
1月前
|
网络协议 安全 Unix
UNIX域套接字(Unix Domain Socket,UDS)之所以高效
UNIX域套接字(Unix Domain Socket,UDS)之所以高效
40 3
|
5月前
|
Unix Docker 容器
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker
|
4月前
|
网络协议 Unix Go
Go unix domain socket通信
Go unix domain socket通信
|
5月前
|
关系型数据库 MySQL 数据库
cant connect to local MySQL server through socket /tmp/mysql.sock (2)
cant connect to local MySQL server through socket /tmp/mysql.sock (2)
101 0
cant connect to local MySQL server through socket /tmp/mysql.sock (2)
|
6月前
|
关系型数据库 MySQL
MySQL安装--显示sever name has already exists
MySQL安装--显示sever name has already exists
|
存储 关系型数据库 MySQL
MySQL出现Data too long for column...(错误号1406)和 Data truncated for column...(错误号1265)
MySQL出现Data too long for column...(错误号1406)和 Data truncated for column...(错误号1265)
583 0
MySQL出现Data too long for column...(错误号1406)和 Data truncated for column...(错误号1265)
|
数据可视化 关系型数据库 MySQL
mysql:解压版MySQL通过SQLyog可视化密码过期问题(错误号码1862)
mysql:解压版MySQL通过SQLyog可视化密码过期问题(错误号码1862)
348 0
mysql:解压版MySQL通过SQLyog可视化密码过期问题(错误号码1862)
|
移动开发 JSON 关系型数据库
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement