我有免费托管的问题,前段时间我想连接到在线数据库,但我收到错误消息:
Warning: mysql_connect(): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
$ I_DB ["host"] = "mysqlX.000webhost.com";
$ I_DB ["user"] = "axx1xxx2_1xxme";
$ I_DB ["pass"] = "x857x49";
$ I_DB ["name"] = "a9x32_xdex";
$ Dbhost = $ i_DB ["host"];
$ Dbuser = $ i_DB ["user"];
$ Dbpass = $ i_DB ["pass"];
$ Dbname = $ i_DB ["name"];
mysql_connect ($ dbhost, $ dbuser, $ dbpass) or die (mysql_error ("Sorry error occurred on the connection to the database, while longer <meta Repeat http-equiv='refresh' content='0'>"));
mysql_select_db ($ dbname) or die (mysql_error ("Sorry error occurred on the connection to the database, while longer <meta Repeat http-equiv='refresh' content='0'>"));
如果有帮助,我将非常感激。 感谢。
答案 0 :(得分:0)
您必须使用localhost而不是“mysqlX.000webhost.com”
$ I_DB ["host"] = "mysqlX.000webhost.com";
答案 1 :(得分:0)
可能存在某些原因,例如数据库服务提供程序的脱机状态或无法从远程位置设置的localhost。因此,请尝试与提供商联系。