无法从我的网络服务器连接到MySQL服务器,使用我的个人盒子上的完全相同的文件工作正常

时间:2021-03-25 19:26:05

I have a godaddy server where I need site users to be able to enter in tracking numbers to see if we have it in the system. I coded it in php/pdo, and it works just fine hosted on my personal machine no matter where it is located (local or remote). I upload the exact same php file to the godaddy server, and all I get is a timeout and a mysql error saying that it can't connect.

我有一个godaddy服务器,我需要网站用户能够输入跟踪号码,看看我们是否在系统中有它。我在php / pdo中对它进行了编码,无论它位于何处(本地或远程),它都可以在我的个人计算机上托管。我上传完全相同的php文件到godaddy服务器,我得到的是一个超时和一个mysql错误说它无法连接。

1 个解决方案

#1


0  

change your connection string ip address to localhost . It means your get infomation from the hosting server with this password and username. The username and password and database is your own ofcourse. 1 Question what program are you using to upload the file to the hosting server?

将您的连接字符串IP地址更改为localhost。这意味着您使用此密码和用户名从托管服务器获取信息。用户名和密码以及数据库是您自己的。 1问你用什么程序将文件上传到托管服务器?

    $con=mysqli_connect("localhost","user","pass","my_db") or die(mysql_error());

#1


0  

change your connection string ip address to localhost . It means your get infomation from the hosting server with this password and username. The username and password and database is your own ofcourse. 1 Question what program are you using to upload the file to the hosting server?

将您的连接字符串IP地址更改为localhost。这意味着您使用此密码和用户名从托管服务器获取信息。用户名和密码以及数据库是您自己的。 1问你用什么程序将文件上传到托管服务器?

    $con=mysqli_connect("localhost","user","pass","my_db") or die(mysql_error());