Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot connect to database (000webhost)

Tags:

php

mysql

$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");

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.

like image 673
S.S Avatar asked Jul 18 '26 10:07

S.S


1 Answers

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).

enter image description here

like image 177
Phiter Avatar answered Jul 20 '26 23:07

Phiter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!