Can’t connect to local MySQL server through socket ‘/tmp/mysql/mysql.sock’解决方法

原因在于/tmp/mysql/mysql.sock不存在,为/usr/local/mysql/mysql.sock建立一个软连接到/tmp/mysql/mysql.sock即可。

1 ln -s /usr/local/mysql/mysql.sock /tmp/mysql/mysql.sock

也有可能是/tmp/mysql/mysql.sock存在,但权限不对,可以用以下命令修改权限

Chown -R mysql:mysql /tmp/mysql
时间: 2024-09-28 16:34:59

Can’t connect to local MySQL server through socket ‘/tmp/mysql/mysql.sock’解决方法的相关文章

解决mysql报错Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’

启动mysql 报错: 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/

MAC中Django中runserver提示Can't connect to local MySQL server through socket '/tmp/mysql.sock错误

好像不止遇到一次,直接Google就可以了,在stackoverflow中就有答案,答案就是你没有开MySQL - -. stackoverflow链接见 http://stackoverflow.com/questions/16325607/cant-connect-to-local-mysql-server-through-socket-tmp-mysql-sock 开启MySQL的命令如下: mysql.server start MAC中Django中runserver提示Can't co

Can't connect to local MySQL server through socket '/tmp/mysql.sock'

启动mysql之后,不能进入mysql命令行: Can't connect to local MySQL server through socket '/tmp/mysql.sock': 修改/etc/my.cnf 当中 socket=/tmp/mysql.sock 重启mysql,即可 Can't connect to local MySQL server through socket '/tmp/mysql.sock'

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

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

我在源码编译安装mysql后,虽然mysql服务可以正常启动,但是当我直接执行mysql后,出现了错误. 错误提示如下: [[email protected] ~]# mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 出现错误原因: 由于mysql 默认的mysql.sock 是在/var/lib/mysql/mysql.sock,但linux系统总

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

原因:找不到mysql.sock文件 解决方法: 1 找到mysql.sock文件位置 echo "show variables" | mysql | grep "socket"或者echo "status" | mysql | grep "socket" 2 ln -s /var/lib/mysql /mysql .sock /tmp/mysql .sock 将两个文件做一个软连接 ERROR 2002 (HY000): C

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.报这个错误的原因

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

这个实在linux下安装mysql的情况,出现了Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 这个错误,然后service mysql start 一直启动不了. 那么可以用一下的方法 #ps -A|grep mysql 显示类似: 3016 ?        00:00:00 mysqld_safe 3090 ?        00:00:31 mysqld 2.#kill -9 3016 3.

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

[[email protected] ~]#   /usr/bin/mysqladmin -u root password 'aaaaaa' /usr/bin/mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' Check that mysqld is runni