MySQL 错误 2013

发布于 2024-07-24 10:00:11 字数 213 浏览 5 评论 0原文

当我运行程序超过几天时,我遇到了 MySQL 连接失败的问题。连接到数据库时,MySQL 错误代码为 2013。 MySQL服务器和客户端程序都在同一台机器上。 我使用 FC5 作为我的操作系统,MySQL 版本是 5.0.18。 有人能解释一下吗?

我在调用 mysql_real_connect() 时收到 mysql 错误 2013...

任何帮助表示赞赏。

I am facing connection failure to MySQL problem when I run my program for more than couple of days.MySQL Error Code is 2013 while connecting to Database. MySQL server and client programs are both on same machine. I am using FC5 as my OS and MySQL version is 5.0.18. Can anybody throw some light on this?

I am getting mysql error 2013 while calling mysql_real_connect()...

Any help is appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(6

硬不硬你别怂 2024-07-31 10:00:11

尝试使用 localhost,而不是您自己的 IP。
我不知道为什么,但这立即解决了我的问题。

如果有人能澄清,我将非常感激
为什么这突然起作用了。

Try using localhost, instead of your own IP.
I don't know why, but this immediately fixed the problem for me.

I would be very grateful if someone could clarify
why this worked, all of a sudden.

夜空下最亮的亮点 2024-07-31 10:00:11
  1. 听起来像是防火墙问题。 您是否尝试过暂时禁用防火墙?

  2. 另一种可能的解决方案涉及编辑启动脚本,如此处所述 并注释掉以下行:

    SKIP=skip-networking

  3. 提到了第三种可能的解决方案此处。 用户尝试访问 InnoDB 数据库,但 MySQL 服务器意外停用了 InnoDB 支持。

  4. (新)我发现这篇 MySQL 官方文章 其中有很多解决问题的方法。 你修改了wait_timeout系统变量吗?

  1. Sounds like a firewall issue. Have you tried disabling the firewall temporarily?

  2. Another possible solution involves edition the startup script as mentioned here and commenting out the following line:

    SKIP=skip-networking

  3. A third possible solution is mentioned here. The user tried to access an InnoDB database and InnoDB support was accidentially deactivated for the MySQL server.

  4. (new) I found this official MySQL article which has lots of approaches to solve the problem. Did you modify the wait_timeout system variable?

陪你到最终 2024-07-31 10:00:11

这是您可能意想不到的答案。 我也遇到过同样的问题。 MySQL 错误 2013。以下是症状:

  1. PHPMyAdmin 触发了 2013 并出现错误 95。

  2. 我可以通过 shell 进入 MySQL 监视器,但花费了非常长的时间开始。 一旦命令行实用程序启动,我就可以查看表并且一切正常

  3. 服务器花了很长时间才能停止并重新启动。

  4. MySQL 错误日志中没有错误。

我与一位优秀的系统管理员一起工作,他检查了 netstat -tn,得到了答案:

tcp        0      0 [my.srv.ip]:3306     184.73.87.215:59271     ESTABLISHED
tcp        0      1 [my.srv.ip]:38138    184.73.87.215:113       SYN_SENT

IP 解析为 Amazon Web Services。 尽管除了端口 80 之外的所有端口都是只允许的,但还是有一些混蛋正在窃取我的 3306 端口。 是时候检查我的防火墙规则了。

没有新表,mtop 没有显示任何活动,但我在身份验证日志中发现了大量这些活动:

Apr 19 15:14:52 magic2 mysqld[18953]: refused connect from ec2-184-73-87-215.compute-1.amazonaws.com
Apr 19 15:18:02 magic2 mysqld[18953]: refused connect from ec2-184-73-87-215.compute-1.amazonaws.com

在 iptables 中阻止有问题的 IP 后,问题突然消失了。 鬼鬼祟祟的混蛋。 这个故事的寓意是:看起来像错误的东西可能是黑客。

巴兹

Here's an answer you might not expect. I had encountered the same problem. MySQL Error 2013. Here are the symptoms:

  1. PHPMyAdmin fired off 2013 and error 95.

  2. I could shell into the MySQL monitor, but it took an inordinately long time to start. I could view tables and everything worked once the command line utility started

  3. The server took a LONG time to stop and restart.

  4. No errors in the MySQL error log.

I work with a good sysadmin who checked netstat -tn, which yielded the answer:

tcp        0      0 [my.srv.ip]:3306     184.73.87.215:59271     ESTABLISHED
tcp        0      1 [my.srv.ip]:38138    184.73.87.215:113       SYN_SENT

The IP resolves to Amazon Web Services. Some prick was leeching onto my 3306, even though everything but port 80 is allow-only. It's time to review my firewall rules.

There were no new tables, and mtop didn't show any activity, but I found a ton of these in the auth log:

Apr 19 15:14:52 magic2 mysqld[18953]: refused connect from ec2-184-73-87-215.compute-1.amazonaws.com
Apr 19 15:18:02 magic2 mysqld[18953]: refused connect from ec2-184-73-87-215.compute-1.amazonaws.com

After blocking the offending IP in iptables, the problem suddenly went away. Sneaky Bastards. The moral of this story is: What looks like bug, might be a hacker.

bz

花开雨落又逢春i 2024-07-31 10:00:11

检查你的 my.cnf。 将您的绑定地址设置为服务器的 IP 地址。 为我解决了这个问题。 似乎没有人知道这个问题的答案!

Check your my.cnf. Set your bind-address to the server's IP address. Solved the issue for me. NO ONE seemed to know the answer to that one!

太阳公公是暖光 2024-07-31 10:00:11

我的解决方法是 - 将“localhost”更改为“127.0.0.1”

My fix was - change 'localhost' to '127.0.0.1'

分分钟 2024-07-31 10:00:11

可能是网络错误导致 TCP/IP 连接断开,或者超出了服务器上的 wait_timeout; 后者实际上有助于减少打开连接的数量,但应用程序将需要正确处理错误代码 2013!

It could be a network error that caused the TCP/IP connection to drop, or the wait_timeout was exceeded on the server; the latter can actually be useful in keeping the # of open connections down, but the app will then need to handle errorcode 2013 correctly!!

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