MySQL 的套接字问题

发布于 2024-09-05 15:06:45 字数 959 浏览 1 评论 0原文

这是最近的一个问题...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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

千紇 2024-09-12 15:06:48

套接字位置在 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.

尤怨 2024-09-12 15:06:48

要检查的事情:

  1. mysql 是否正在运行? ps auxw | <代码> grep mysql 。如果没有显示任何内容,则它没有运行,这解释了缺少套接字的情况。
  2. 如果 apache 没有运行,那么它会抛出一个错误来尝试停止它。如果 Apache 正在运行,ps auxw|grep httpd 应显示许多 httpd 子进程。如果无法启动,它会在 error_log 中解释原因,您可以从 httpd.conf 文件中获取该日志的位置。
  3. 您下载的 mysql .tar.gz 文件名表明它实际上是预编译的二进制版本。因此,不会有“配置”脚本。 mysql.com 没有 MacOS 特定的源文件。这里只有一个通用的 .tar.gz (在下拉框)适用于非 Linux 系统..

Things to check:

  1. Is mysql even running? ps auxw | grep mysql. If nothing shows up, it's not running, which explains the lack of a socket
  2. If apache wasn't running, then it'd throw an error trying to stop it. ps 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.
  3. The filename of the mysql .tar.gz you downloaded suggests that it's actually a pre-compiled binary version. As such there wouldn't be a 'configure' script. mysql.com doesn't have a MacOS specific source file. There's just a generic .tar.gz here (select 'Source Code' in the dropdown box) for non-Linux systems..
南…巷孤猫 2024-09-12 15:06:47

终于弄清楚了...我几乎尝试了所有方法,但这一切都归结为删除 MySQL 的每个实例,而当我删除所有内容时,我丢失了一些东西。要完全卸载 MySQL:

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm /etc/my.cnf

此外,您还必须从 /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:

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm /etc/my.cnf

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文