无法连接到数据库 (000webhost) [英] Cannot connect to database (000webhost)

查看:53
本文介绍了无法连接到数据库 (000webhost)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$host="mysql13.000webhost.com";      
$username="a1346032"; 
$password="<password>"; 
$db_name="a1346032_newdb"; 
$tbl_name="members"; 

mysqli_connect("$host", "$username", "$password")or die("cannot connect"); 
mysqli_select_db("$db_name")or die("cannot select DB");

我已经在免费托管站点 000webhost 中创建了我的 mysqli 数据库,现在我想将我的数据库连接到我的 php 代码,但是每次我收到mysqli_connect(): (HY000/2002): 连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接的主机未能响应而建立连接失败.在 C:\wamp\www\hh1\checklogin.php 中,第 11 行请帮助我解决这个问题并建议我必须加起来吗?谢谢.

I have made my mysqli database in free hosting site 000webhost now i want to connect my database to my php code but every time i am getting error that "mysqli_connect(): (HY000/2002): 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. in C:\wamp\www\hh1\checklogin.php on line 11" please help me on this and suggest if i have to add up something? thanks.

推荐答案

000webhost 只允许您通过它自己的 PHP 主机或它自己的 PHPMyAdmin 访问数据库.

000webhost only lets you access the database through it's own PHP host or it's own PHPMyAdmin.

除非您升级帐户(通过付费),否则您无法从自己的计算机或其他服务器访问它.

You can't access it from your own computer or another server, unless you upgrade your account (by paying).

这篇关于无法连接到数据库 (000webhost)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆