我从以下位置安装了 MySQL:
http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg
我使用的是 OS X 10.5.8。我打开终端并执行以下操作:
cd /usr/local/bin
然后:
mysql -u root
我收到以下错误:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
我花了 2 个小时浏览网站,寻找一个合理的答案。这是一台全新的笔记本电脑。我不知所措。这是我的 .bash_profile:
export PYTHONPATH=/Users/blwatson/pythonpath;/Users/blwatson/pythonpath/bin:$PYTHONPATH
# Setting PATH for MacPython 2.6
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}"
export PATH
export
PATH=/usr/local/mysql/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
我不知所措。安装顺序是:
1)Django 2)Python 2.6 3)MySQL 5
答案1
检查 /tmp/mysql.sock 中是否存在套接字。如果不存在,则启动 mysql
sudo /usr/local/mysql/bin/mysqld_safe
然后尝试登录mysql客户端
/usr/local/mysql/bin/mysql -u root
答案2
你启动了 MySQL 吗?
答案3
要启动 MySql,请转到系统偏好设置 > MySql > 启动