Home > Database > Mysql Tutorial > Linux 下找不到 mysql.sock 的解决方法

Linux 下找不到 mysql.sock 的解决方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:57:01
Original
1451 people have browsed it

出现以下的信息:Got an error: Connection error: Canrsquo;t connect to local MySQL server through socket lsquo;/var/lib/

出现以下的信息:

Got an error: Connection error: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’

mysql.sock 突然消失算是常见的问题,如果是第一次安装MySQL才出现,那只要找出 mysql.sock 在哪里就可以了。

以上述的错误信息,mysql.sock 应该是在 /var/lib/mysql/ 里面 ,,如果没有的话,就下:

#find / -name mysql.sock

来找看看放在哪里,找到之后再下:

#mysqladmin -S /找到路径/mysql.sock -u root {参数}

那…如果是突然不见的,或是都找不到怎麽办?

那只好重新启动 mysql 了,tarball 安装可以透过 mysqld 或 mysqladmin 重新启动,rpm 安装可以透过 service mysql restart 。但是在 mysql.sock 不见的情况下,可能是无法重新启动 mysql 的,如果真的不行,只好先下:

#ps -aux|grep mysql

再把看到的 pid 先砍了

#kill 看到的pid

确定全部都杀完了,再看一次还有没有

#ps -aux|grep mysql

确定里面的 mysql 都没有了,然后再执行 mysqld 或是 service mysql start 就可以了。

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template