dongnei3634 2013-10-12 17:39
浏览 103

mysql_connect()失败 - 错误(4)

I developed a PHP application with MySQL and node.js implementation. I am trying to connect to my production DB like the following:

mysql_connect('54.212.117.38', 'root', '********');

This is the Error I get :

Could not connect: Can't connect to MySQL server on '54.212.117.38' (4)

I must mention that I can reach the PHPmyAdmin directly through the browser.

Moreover, On local host the application is connecting to MySQL with no problem. I also tried restarting the Apache server, shutting down the Node.js procedure...

BTW - My production server is running Ubuntu.

Does anyone has an idea on what's the reason that it doesn't work?

  • 写回答

2条回答 默认 最新

  • dongyou6847 2013-10-12 17:49
    关注

    There is more than one possibility. Some advice:

    • Make sure the mysql server behind this IP address is running and accepting connects.
    • Make sure the user can access from your clients ip.
    • Check out if perhaps the connection process takes too long (in this case, you can try increasing the connect_timeout).
    • If nothing else helps, trace the traffic between client and server. Maybe a firewall is slightly too aggressive (I've had that once, user root was triggering an IDS rule...).

    A sidenote, the mysql extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog