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

安装mysql但是从来没启动过,今天一启动就报错:

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

其实是mysql服务没起来。。。

localhost:~ miaoying$ mysql.server start
Starting MySQL
... SUCCESS! 

然后再去sudo mysql就行了

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

原文地址:https://www.cnblogs.com/miaoying/p/10352893.html

时间: 2024-10-09 00:41:59

Mac端解决:Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)的相关文章

mac 安装mysql 报错“ERROR 2002 (HY000): Can not connect to local MySQL server through socket '/tmp/mysql.sock' (2)” 解决办法

首先安装 homebrew 再 brew install mysql 之后连接 mysql 无论是登录还是修改初始密码都会报如下的错误 ERROR 2002 (HY000): Can not connect to local MySQL server through socket '/tmp/mysql.sock' (2) 运行如下解决:参考 http://www.thinksaas.cn/group/topic/347978/ unset TMPDIR mysql_install_db --v

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

我的环境:Mac 10.11.6 ,mysql  5.7.14  . mac mySql 报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 这个错是链接时报的错,要链接必须启动.修复的时候首先要启动mysql. 首先来了解一下 mysql.sock的作用: Mysql有两种连接方式: (1),TCP/IP (2),socket 对mysql.sock来说,其

Mac OS X下MySQL出现Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)的问题

网上类似的很多,大都是说修改my.cnf之类的,在我这种情况下不凑效,另外,好多都是Linux下的,试了好久,最后的原因竟然相当简单:MySQL服务没起来. 因为对mysql.sock文件不是很熟,刚开始很大的时间都浪费在了这上面,重装后都不行,后来进入/usr/local/mysql/bin/下使用mysqld启动,出现下面的问题 好吧,我用root启动,结果又出现 Please read "Security" section of the manual to find out ho

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

mac使用brew安装mysql报RROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

使用mac安装mysql安装完后运行 mysql -uroot -p 报了 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 这是由于我们没有启动mysql,启动mysql使用 brew services start mysql或者 mysql.server start 在启动前我们可以设置一下root密码 mysql_secure_installation 然

Mac下Mysql启动异常["ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)"]

在mac下使用brew安装mysql,之前没有使用过,今天启动的时候发现启动不了 huijundeMacBook-Pro:bin huijunzhang$ mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 查看mysql的安装位置: huijundeMacBook-Pro:bin huijunzhang$ which mysql /usr/local

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

好久不用mysql,今天突然想用的时候, mysql -uroot -p 直接报了下面的错误 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) mac可以在设置里面启动mysql,设置里面启动mysql的时候提示没有/usr/local/mysql/data的权限, 给予权限 sudo chown -R mysql:mysql  /usr/local/mysql

解决连接mysql时报错"Can't connect to local MySQL server through socket '/tmp/mysql.sock'"

命令行连接mysql时,报了“Can't connect to local MySQL server through socket '/tmp/mysql.sock'”的错误:用Navicat连接是报62号错误. 首先确定我本机是装了mysql的 尝试用安全模式启动mysql,命令行执行: /usr/local/bin/mysqld_safe 完了之后运行mysql,成功了. 解决连接mysql时报错"Can't connect to local MySQL server through soc

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系统总