原来如此简单:解决Mac上的Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
来源:互联网 发布:mac上炒股软件 编辑:程序博客网 时间:2024/05/16 12:18
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 Can't connect to local MySQL server
error might occur:
mysqld is not running on the local host. Check your operating system's process list to ensure the mysqld process is present.
- 。。。
结果
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.
有时事情总是用最简单的办法解决
- 原来如此简单:解决Mac上的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)的问题
- 关于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)的问题
- 解决mysql启动问题: Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- ERROR 2002: Can't connect to local MySQL server through socket '/tmp/tmp/mysql.sock' (2)
- ERROR 2002: Can't connect to local MySQL server through socket '/tmp/tmp/mysql.sock' (2)
- 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’错误
- 解决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
- Django +MySQL 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错误:Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- 快速选择算法(基于快排)
- Struts2 常用的constant总结
- MongoDB学习笔记(一)-Insert操作
- Kali Linux Web 渗透测试秘籍 第三章 爬虫和蜘蛛
- mysql操作语法
- 原来如此简单:解决Mac上的Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- 聊聊Java数据库开发的那点事儿
- 笔记(活动(activity)之间的通信)
- 树莓派&qt5交叉编译
- 【罗兰のJava学习笔记】第七天,预定义类
- 经典程序(二)
- qt--创建可隐藏的按钮
- hdu2196(求每一点在树上最远距离)
- python 入门学习之 python 特点分析