MYSQL错误Can't connect to local MySQL server through socket '/var/lib/mysql/mysq

1、
创建/修改文件 /etc/my.cnf,至少增加/修改一行

[mysql]
[client]
socket = /tmp/mysql.sock

#在这里写上你的mysql.sock的正确位置,通常不是在 /tmp/ 下就是在 /var/lib/mysql/ 下
2、
指定IP地址,使用tcp方式连接mysql,而不使用本地sock方式

#mysql -h127.0.0.1 -uuser -ppassword

3、
为 mysql.sock 加个连接,比如说实际的mysql.sock在 /tmp/ 下,则

#ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

即可

MYSQL错误Can't connect to local MySQL server through socket '/var/lib/mysql/mysq

时间: 2024-10-17 09:29:22

MYSQL错误Can't connect to local MySQL server through socket '/var/lib/mysql/mysq的相关文章

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)--MySQL错误

环境:RHEL5.5 centos的yum源更新 1.启动MySQL出现错误: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 2.解决方法(摘自:http://wenda.haosou.com/q/1364099334067193?src=150) 1.先查看 /etc/rc.d/init.d/mysqld status 看看m y s

MYSQL错误解决:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 据说这个问题的原因很多,当然,我自己这个问题我是清楚的,就是mysql.sock的位置所致,一个是PHP要求的,一个是MYSQLD定义的,一个是MY.CONF指定的...SO.... 暂时不能统一的话,用软链接LN -S命令解决吧.. 方案5 摘要:解决不能通过mysql.sock连接MySQ

启动mysql错误ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) 1.先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.另外看看是不是权限问题. 2.确定你的mysql.sock是不是在那个位置,mysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock 3

mysql Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

错误原因:/var/lib/mysql目录中socket文件不存在.连接mysql服务器有两种方式:tcp连接,通过socket文件连接.通过socket文件,启动mysql服务,mysql服务会自动生成一个sock文件,生成的sock文件默认放在 --datadir=/var/lib/mysql,mysql默认从/var/lib/mysql目录读取sock文件. 解决办法:1.看看/var/lib/mysql/mysql 有没有mysql.sock文件2.没有mysql.sock,重启mysq

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

在Centos系统输入mysql回车出现以下错误的解决方法: MYSQL错误:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 解决方法一: 如果是以yum方法安装: 直接service mysqld start启动后 再输入mysql命令可进入mysql数据库 Can't connect to local MySQL server thro

服务器数据库挂掉 Can 't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock '(2) ";

刚刚遇到这个报错,我无语了,我这么个菜逼,咋解决,还好师兄(付付)解决了,付付真棒,在此记录一下,以供学习 Can 't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock '(2) "; 1.查日志(首先还是看error.log),我看了一遍,继续急,师兄看了一遍 2. can't create /write to file 'tmp'  ,fk,就是/tmp的权限问题,害我干着急 3.报这个错误的原因

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

当使用host参数为"localhost"连接Mysql服务时,会优先使用"sock文件"进行连接,而不是使用"IP:端口"进行连接,而Mysql尝试使用"sock文件"进行连接时,却无法获取"sock文件"的位置. 要解决此错误,解决方法: 将连接参数"host"的值由"localhost"改成"127.0.0.1": ERROR 2002 (H

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.socket

一.解决var/run/mysqld没有pid和sock文件 MySQL下mysql.sock丢失丢失的原因一般是因为配置文件不一致的原因,mysqld 错误启动,mysqld_safe 会清除一次mysql.sock .解决方法是: 判断一般人解决故障时没有切换到mysql用户,造成权限有问题,无法创建mysql授权表,所以也就无法创建/tmp/mysql.sock 和hostname.pid文件.因此,总结解决方法如下: #su mysql  // root 用户也是可以的 $/usr/lo

报了:Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)的错。

解决方法: 1.查看是不是mysql权限的问题 (默认安装方式为 yum -y install mysql) 转到  /etc/rc.d/init.d/目录下 [[email protected] init.d]# mysqld status2018-06-11 15:20:47 0 [Warning] TIMESTAMP with implicit DEFAULT value is depreca ted. Please use --explicit_defaults_for_timestam