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