原来如此简单:解决Mac上的Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
2016-10-14 20:26
531 查看
mac os上第一次使用mysql,果然出现了问题,安装好mysql的dmg后,在终端输入mysql,结果出现
hrfpc:~ hrf$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
这个错误
在网上搜到很多方法,不好使,然后查询了官方文档
http://dev.mysql.com/doc/refman/5.7/en/can-not-connect-to-server.html
下面写道
Here are some reasons the
might occur:
mysqld is
not running on the local host. Check your operating system's process list to ensure the mysqld process
is present.
。。。
没想到第一条就符合,然后我尝试输入mysqld
结果
hrfpc:~ hrf$ mysqld
mysqld: Can't change dir to '/usr/local/mysql-5.7.16-osx10.11-x86_64/data/' (Errcode: 13 - Permission denied)
等一大串错误之类的 ,最后退出了
最后,正确的方法:
hrfpc:~ hrf$ sudo mysqld_safe
2016-10-14T11:47:17.6NZ mysqld_safe Logging to '/usr/local/mysql/data/hrfpc.err'.
2016-10-14T11:47:17.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
然后mysqld服务就运行啦
此时,终于能够打开mysql:
hrfpc:etc hrf$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.7.16
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
有时事情总是用最简单的办法解决
hrfpc:~ hrf$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
这个错误
在网上搜到很多方法,不好使,然后查询了官方文档
http://dev.mysql.com/doc/refman/5.7/en/can-not-connect-to-server.html
下面写道
Here are some reasons the
Can't connect to local MySQL servererror
might occur:
mysqld is
not running on the local host. Check your operating system's process list to ensure the mysqld process
is present.
。。。
没想到第一条就符合,然后我尝试输入mysqld
结果
hrfpc:~ hrf$ mysqld
mysqld: Can't change dir to '/usr/local/mysql-5.7.16-osx10.11-x86_64/data/' (Errcode: 13 - Permission denied)
等一大串错误之类的 ,最后退出了
最后,正确的方法:
hrfpc:~ hrf$ sudo mysqld_safe
2016-10-14T11:47:17.6NZ mysqld_safe Logging to '/usr/local/mysql/data/hrfpc.err'.
2016-10-14T11:47:17.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
然后mysqld服务就运行啦
此时,终于能够打开mysql:
hrfpc:etc hrf$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.7.16
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
有时事情总是用最简单的办法解决
相关文章推荐
- 解决mysql启动问题: Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- 解决Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误
- 解决Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误
- mac 下的mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock
- 解决Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) "
- Can't connect to local MySQL server through socket '/tmp/mysql.sock'解决
- 解决ERROR 2002 (HY000): 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
- mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' 解决方法
- 解决Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误
- 解决Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误
- mac ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- Can’t connect to local MySQL server through socket ‘/tmp/mysql/mysql.sock’解决方法
- centos7 安装mysql 报错:亲测有效,解决Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2)
- 亲测有效,解决Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) ";
- 解决Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) ";
- 解决“ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)”
- 解决“ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (60)”
- 解决*unix系统下Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- 解决Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) ";