解决ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
来源:互联网 发布:网络教育本科学费 编辑:程序博客网 时间:2024/06/05 00:35
在Mac和XAMPP环境下,如果在终端敲入MySQL,可能会出现这种问题:
再按一下 esc 键 ,结束编辑
并输入 :wq 存储离开
再输入 source ~/.bash_profile 即可
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
这种问题是由于没有在bash_profile中配置xampp的path解决方案:
首先,在终端输入
- cd ~/
而.bash_profile为该目录下的一个隐藏文件
可使用文字编辑器vi 直接新增
在终端上输入 sudo vim ~/.bash_profile
按i进入编辑模式,在末尾添加:
- <span style="font-size:18px;"># User specific environment and startup programs
- export XAMPP_HOME=/Applications/xampp/xamppfiles
- export PATH=${XAMPP_HOME}/bin:${PATH}
- export PATH</span>
再按一下 esc 键 ,结束编辑
并输入 :wq 存储离开
再输入 source ~/.bash_profile 即可
接下来,再终端敲mysql,就可以正常进入mysql了。
如果遇到了其他类似XAMPP相关的问题,
阅读全文
0 0
- ERROR 2002 (HY000): 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' (2)
- ERROR 2002 (HY000): 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' (2)
- ERROR 2002 (HY000): 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' (2)
- ERROR 2002 (HY000): 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' (2)
- ERROR 2002 (HY000): 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' (2)
- ERROR 2002 (HY000): 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' (2)
- ERROR 2002 (HY000): 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' (2)
- 解决ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- 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'
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'
- hdu-1269-迷宫城堡-Tarjan算法-java
- 清华大学2009年机试-递推数列-1081
- 山东省第八届ACM省赛 I 题 Parity check 详解
- c++ vector erase用法
- Animation
- 解决ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- python argparse用法总结
- [i.MX6Q][QNX Neutrino 6.6.0]调试笔记------IPL源码分析
- (OpenCV3.2.0)基于HOG特征的SVM训练与测试实例
- Area in Triangle(计算几何基础)
- c++ primer plus阅读笔记12---手动调用析构函数
- 人脸识别
- 安装mac版本的mysql详细教程
- PCA的数学原理