Mountain Lion:无法通过套接字"/tmp/mysql.sock"连接到本地MySQL服务器 [英] Mountain Lion: Can't connect to local MySQL server through socket '/tmp/mysql.sock'

查看:92
本文介绍了Mountain Lion:无法通过套接字"/tmp/mysql.sock"连接到本地MySQL服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过自制软件安装了mysql.我运行了brew建议的两个命令:

I installed mysql via homebrew. I ran the two commands brew suggests:

unset TMPDIR

mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

当我尝试运行mysql_secure_installation脚本时,出现此错误:

When I tried to run the mysql_secure_installation script, I receive this error:

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

一个单独的线程使我相信它与权限有关:连接通过套接字连接到本地MySQL服务器

A separate thread led me to believe it had to do with permissions: connect to local MySQL server through socket

我运行了建议的命令,将其mysql目录替换为

I ran the suggested commands substituting their mysql directory with

/usr/local/var/mysql

但是,问题仍然存在.救命!

Yet, the problem persists. Help!

推荐答案

您的套接字可能是在非标准位置创建的.我的Homebrew安装程序例如是在/tmp/mysql.sock中创建的.

Your socket is probably being created in a non-standard location. My Homebrew installation creates it in /tmp/mysql.sock for instance.

如果可以通过TCP/IP套接字连接到服务器,请运行以下命令:

If you can connect to the server over the TCP/IP socket, run this:

SHOW VARIABLES LIKE '%sock%';

否则,请尝试在系统上的某个位置查找它:

Otherwise, try to look for it somewhere on your system:

find / -name mysql.sock

这篇关于Mountain Lion:无法通过套接字"/tmp/mysql.sock"连接到本地MySQL服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆