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 how to run mysqld as root!

最后才知道,MySQL为了安全,不希望root用户直接启动mysql,关于这个问题,可以参考(http://blog.csdn.net/jubincn/article/details/6725582)。所以,最后的解决办法就是

sudo ./mysqld --user=root

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

时间: 2024-11-08 15:26:47

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

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 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中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 安装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使用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 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

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 thro

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

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.