Quick question here, I'm new to web hosting and I'm just having a muck around to see what's what. I've created the following PHP document and hosted it on my free 000webhost domain:
<?php
$mysql_host = "mysqlXX.000webhost.com";
$mysql_database = "***********_people";
$mysql_user = "*************_admin";
$mysql_password = "******************";
// Create connection
$con=mysqli_connect($mysql_host,$mysql_database,$mysql_user,$mysql_password);
// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
I have set up (hopefully correctly) a small table in my database with 3 fields:
- ID - No Null, auto-increment, integer, primary
- First Name - VarChar, Length 20
- Last Name - VarChar, Length 20
And entered data for each one. When I open the file from my control panel, I get the following error:
Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'a4935911_people'@'10.1.1.45' (using password: YES) in /home/a4935911/public_html/MySQL+PHP.php on line 9
AND
Failed to connect to MySQL: Access denied for user 'a4935911_people'@'10.1.1.45' (using password: YES)
Any ideas, anyone?
_admin, then how come the error message says it was…_people…?$con=mysqli_connect($mysql_host,$mysql_user,$mysql_password,$mysql_database);and it will work.GRANTcommand. Check my answer.