MySQL 的套接字问题
这是最近的一个问题...MySQL 正在工作,几天前我一定做了一些事情。我删除了 MySQL 并尝试使用 .dmg 文件重新安装。 mysql.sock 文件永远不会被创建,我收到以下错误消息:
Hristo$ mysql
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
我也尝试停止 Apache 并安装,但 Apache 给了我一个错误...我不知道这是好是坏:
Hristo$ sudo apachectl stop
launchctl: Error unloading: org.apache.httpd
我尝试了 MacPorts 安装好吧,但套接字文件仍然没有创建。我真的不知道该怎么做,我不想重新安装 Snow Leopard 并从头开始:/
我也尝试安装 32 位版本和同样的交易。运气不好。
最后...我尝试进行源安装,但是当我进入配置步骤时,出现以下错误:
-bash: ./configure: No such file or directory
The file is "mysql-5.1.47-osx10.6-x86_64.tar.gz" so I think it is源安装的正确文件,是的,我有 64 位系统。我不知道该怎么办了。
有什么想法吗?
谢谢, Hristo
编辑:这是我使用 .dmg 包安装 MySQL 后得到的结果...我真的不知道这意味着什么?那么MySQL是否正在运行呢?我想不是吗?
赫里斯托$ ps auxw | grep mysql 赫里斯托 1599 0.2 0.0 2425520 96 s000 R+ 3:39AM 0:00.00 grep mysql
This is a recent problem... MySQL was working and a couple of days ago I must have done something. I deleted MySQL and tried reinstalling using the .dmg file. The mysql.sock file never gets created and I get the following error messages:
Hristo$ mysql
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
I also tried stopping Apache and installing but Apache gave me an error... I don't know if this is good or bad:
Hristo$ sudo apachectl stop
launchctl: Error unloading: org.apache.httpd
I tried the MacPorts installation as well but the socket file still didn't get created. I don't really know what to do and I don't want to reinstall Snow Leopard and start from scratch :/
I also tried installing the 32-bit version and same deal. No luck.
Finally... I tried doing the source installation but when I get to the configuration step, I get the following error:
-bash: ./configure: No such file or directory
The file is "mysql-5.1.47-osx10.6-x86_64.tar.gz" so I think it is the proper file for source installation and yes I have a 64 bit system. I don't know what to do anymore.
Any ideas?
Thanks,
Hristo
Edit: This is what I get after installing MySQL using the .dmg package... I don't really know what it means? So is MySQL running or not? I think not?
Hristo$ ps auxw | grep mysql
Hristo 1599 0.2 0.0 2425520 96 s000 R+ 3:39AM 0:00.00 grep mysql
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
套接字位置在 my.cnf 中定义。mysql
客户端和服务器必须使用相同的套接字路径才能连接。确保 mysql 客户端和服务器都使用相同的配置文件或更改配置,以便它们使用相同的套接字。
您还可以执行
which mysql
以确保您使用正确的 mysql 二进制文件。The socket location is defined in my.cnf
Both the mysql client and server must use the same socket path in order to connect. Make sure that both the mysql client and server use the same configuration file or change the configuration so that they use the same socket.
You may also do
which mysql
to ensure you're using the right mysql binary.要检查的事情:
ps auxw|grep httpd
应显示许多 httpd 子进程。如果无法启动,它会在 error_log 中解释原因,您可以从 httpd.conf 文件中获取该日志的位置。Things to check:
ps auxw | grep mysql
. If nothing shows up, it's not running, which explains the lack of a socketps auxw|grep httpd
should show a number of httpd child processes if Apache is running. If it can't start up, it will explain why in the the error_log, the location of which you can get from the httpd.conf file.终于弄清楚了...我几乎尝试了所有方法,但这一切都归结为删除 MySQL 的每个实例,而当我删除所有内容时,我丢失了一些东西。要完全卸载 MySQL:
此外,您还必须从
/etc/hostconfig
文件中删除“MYSQLCOM=-YES-
”行。我的问题是我从未删除/etc/my.cnf
文件!如果你不删除这个文件,显然你会遇到套接字问题!所以这就是罪魁祸首。然后我只是从 MySQL 网站的.dmg
文件进行了常规安装,一切正常:)感谢大家的建议和时间!
Finally figured it out... I tried pretty much everything but it all came down to deleting every instance of MySQL and I was missing something when I was deleting everything. To completely uninstall MySQL:
Also, you have to remove the line “
MYSQLCOM=-YES-
” from the/etc/hostconfig
file. My problem was that I never removed the/etc/my.cnf
file! If you don't delete this file, apparently you get socket issues! So that was the culprit. Then I just did a regular install from the.dmg
file from the MySQL website and everything works :)Thanks everyone for their suggestions and time!