未创建mysql.sock OSX [英] mysql.sock is not created OSX

查看:113
本文介绍了未创建mysql.sock OSX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在OSX上运行mysql,现在当我重新启动计算机时,它不会创建mysql.sock,这意味着我所有的连接都给我一个错误2002.

I run mysql on OSX, now when I restart my computer it does not create the mysql.sock, meaning that all my connections gives me a error 2002.

有人知道如何预防吗?

推荐答案

我在Snow Leopard上也遇到了同样的问题,由于某些原因,套接字在错误的位置在OS X上生成.

I had this same issue on Snow Leopard, the socket spawns in the wrong location for some reason on OS X.

要使套接字在正确的位置生成: 在/etc中使用以下几行创建一个新文件"my.cnf":

To get the socket spawning in the correct location: create a new file "my.cnf" in /etc with the following lines:

[mysqld]
socket=/var/mysql/mysql.sock

[client]
socket=/var/mysql/mysql.sock

并重新启动mysqld:sudo/usr/local/mysql/bin/mysqld_safe

and restart mysqld: sudo /usr/local/mysql/bin/mysqld_safe

这将强制MySQL套接字文件在正确的位置生成,并且一切正常.祝你好运!

This will force the MySQL socket file to spawn in the proper location, and everything should work normally. Good luck!

这篇关于未创建mysql.sock OSX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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