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

原创 2016年05月26日 16:00:16

http://androidren.com/index.php?qa=392&qa_1=error-hy000-connect-local-mysql-server-through-socket-mysql

前提:苹果电脑下面遇到此问题。

 

一、现象

当执行下面命令时遇到如下错误:

licong$ mysql -u root -p

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

 

二、解决

看了很多解决方法,都没有解决。最后用下面的方法解决。

先直接更新mysql的权限:

licong$ sudo chown -R mysql:mysql  /usr/local/mysql/

然后去mac的设置里面开启:

 

三、参考

http://stackoverflow.com/questions/4788381/getting-cant-connect-through-socket-tmp-mysql-when-installing-mysql-on-m


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

在Mac和XAMPP环境下,如果在终端敲入mysql,可能会出现这种问题: ERROR 2002 (HY000): Can't connect to local MySQL server thr...
  • luoshengkim
  • luoshengkim
  • 2015-06-27 12:27:02
  • 5141

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

author:skatetime :2009/10/23 今天同时问我一个关于mysql的问题,记录一下 错误提示:root@localhost ~]# mysql --socket=/tmp/mys...
  • wyzxg
  • wyzxg
  • 2009-10-23 18:39:00
  • 49317

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

1. 问题描述 ubuntu14.10下, 在终端进入mysql的控制台时出现以下信息: $ mysql -uroot -p Enter password: ERROR 2002 (HY000)...
  • Cryhelyxx
  • Cryhelyxx
  • 2015-01-22 10:32:48
  • 5420

记一次 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock’(2) 排错流程

在linux与unix系统的socket文件是为了建立两个程序之间的连接使用的 , 而在mysql中,当mysql启动成功时,会根据配置文件中设定的路径(如:tmp/mysql.sock),在tmp中...
  • yun__yang
  • yun__yang
  • 2017-01-16 12:01:35
  • 36020

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

今天服务器遇到了一个很熟悉的问题 输入#mysql -u root -p ERROR 2002 (HY000):Cant connect to local MySQL server  随即上网找寻答案...
  • lmss82
  • lmss82
  • 2009-08-05 22:42:00
  • 178386

Linux下Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ mysql service 无法正常启动和关闭

Ubuntu下Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ mysql service 无法正常启动和关...
  • dongfangxiaozi_
  • dongfangxiaozi_
  • 2017-06-10 09:43:02
  • 6816

亲测有效,解决Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) ";

最近租了一个阿里云云翼服务器,趁着自己还是一个学生,享受一下优惠。我租的是阿里云Ubuntu16.04版本的服务器,在搭建mysql的时候,一开始是可以运行的,由于某次手抽,把mysql的套接字文件不...
  • hjf161105
  • hjf161105
  • 2017-12-20 10:50:13
  • 16097

解决问题Can’t connect to local MySQL server through socket

摘自http://blog.yousri.org/2009/02/23/mysql-error-2002-mysqlsock.html     不幸遇到Mysql出现ERROR 2002 (HY000...
  • bocycn
  • bocycn
  • 2010-01-07 15:06:00
  • 11591

Linux下mysql启动时报错Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

查询了网上的很多说法,基本都是说重启服务,授权,大多数情况可能是在/tmp目录下没有mysql.sock文件 需要修改etc/my.cnf中socket指向mysql.sock所在目录, [mys...
  • qq_33288567
  • qq_33288567
  • 2017-12-31 10:28:03
  • 493

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

问题如下: 连接到mysq报错: 解决方法: 关闭当前mysql服务: service mysqld stop 修改mysql配置文件my.cnf,添加如下配置: socket = /t...
  • zsl10
  • zsl10
  • 2016-07-06 08:19:06
  • 741
收藏助手
不良信息举报
您举报文章:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
举报原因:
原因补充:

(最多只允许输入30个字)