mac os 启动mysql失败 ERROR 2002 HY000



 bogon:~ ksoul$ /Library/StartupItems/MySQLCOM/MySQLCOM restart
Restarting MySQL database server
bogon:~ ksoul$


 bogon:~ ksoul$ mysql -uroot -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

通过mysql官网下载的 mysql-5.6.24-osx10.9-x86_64.dmg 双击下一步安装,但启动成功,但一运行就报错。系统是MacBook Air os 10.10.2


补充:
在sg抄了一个配置复制到 /usr/local/mysql/my.cnf 中可以了,不过奇怪的事。phpmyadmin中链接地址必须用 127.0.0.1


 [client]
port = 3306
socket = /tmp/mysql.socket
default-character-set = utf8

[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8
init-connect = 'SET NAMES utf8'
max_allowed_packet = 64M
bind-address = 127.0.0.1
port = 3306
socket = /tmp/mysql.sock
innodb_file_per_table = 1

[mysqld_safe]
timezone = '+0:00'

mysql php macosx

石更不起来君 9 years, 8 months ago

重新启动mysql
重新登录
确定你的密码没有错误.

飞花携满袖 answered 9 years, 8 months ago

不是很懂。结合上一个问题,我觉得你可能是第一次使用Mac OS X:

建议使用Homebrew来安装MySQL等等软件,brew相当于CentOS上的yum。

虎皮蛋果珍受 answered 9 years, 8 months ago

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
确定文件是否存在或者权限问题

jhg543 answered 9 years, 8 months ago

Your Answer