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

在Mac和XAMPP环境下,如果在终端敲入mysql,可能会出现这种问题:

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进入编辑模式,在末尾添加:

# User specific environment and startup programs
export XAMPP_HOME=/Applications/xampp/xamppfiles
export PATH=${XAMPP_HOME}/bin:${PATH}
export PATH

再按一下    esc   键 ,结束编辑
并输入    :wq    存储离开
再输入    source ~/.bash_profile     即可


接下来,再终端敲mysql,就可以正常进入mysql了。

如果遇到了其他类似XAMPP相关的问题,

可以访问这个链接:http://www.jroller.com/jnicho02/entry/setting_up_xampp_on_the

遇到问题一定要google,在百度了好几个都是不找边际的解决方案后,我直接google,一下就找到了正确的解决方案,虽说是英文,不过确实靠谱啊!




你可能感兴趣的:(OOAD,&&,UML)