dongxing8650 2015-07-18 03:04
浏览 320

mysql_connect():连接被拒绝

I was just wondering if it was possible for certain databases to block SQL accesses through mysql_connect. I recently downloaded XAmpp and created a SQL database using my own computer as a local host and wrote a PHP file that accessed that database.

However, when I tried to change the username and host settings so that Xampp would run the PHP files that would then connect to the external SQL database of a free hosting site that I'm trying to use (biz.co.nf), I got the following error message:

Warning: mysql_connect(): Connection refused in /Applications/XAMPP/xamppfiles/htdocs/...

Right now I'm thinking either:

  1. My login credentials to that database are incorrect, or

  2. Somehow the host blocks SQL accesses from external users, but if I were to load my php code into the server using FileZilla, it should work okay?

Please let me know if this is the case.

I'm also fairly certain I have the right login credentials.

Here's what I have:

$host = "fdb13.biz.nf";
$username = "1764941_login";
$password = ________;
$db_name = "1764941_Login";!
$tbl_name = "Members";

//Connect to server
mysql_connect($host, $username, $password)or die("Cannot Connect!");
mysql_select_db($db_name)or die("Cannot select Database");

with my server settings according to my website... Settings

Of course, I omitted my password.

  • 写回答

1条回答 默认 最新

  • dongxia2068 2015-07-18 03:30
    关注

    Connections are refused from remote locations to MySQL for security reasons. You can add your IP Address to enable MySQL to listen from your database by following the instructions in this link - Cyberciti biz tips on enabling remote access to mysql database server In your case, add the IP address of the location where your PHP script. I would also say that

    mysql_connect
    

    is deprecated in PHP. Use mysqli instead. Check the comments in the link - PHP original MySQL API

    评论

报告相同问题?

悬赏问题

  • ¥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