This question already has an answer here:
i uploaded my php config code to my server befirstw on cpanel ...under the public html .. my php file is
<?php
$dbhost = "befirstwin.com";
$dbname = "befirstw_intlgent";
$dbuser = "befirstw_intelli";
$dbpass = "Ngcp1988$ ";
$connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
if(mysqli_connect_errno())
{
die("database connection failed: " .
mysql_connect_error() . "(" . mysql_connect_errno() .")"
);
}
$username = isset($_GET['username']) ? $_GET['username'] : '';
$password = isset($_GET['password']) ? $_GET['password'] : '';
$query = "INSERT INTO users
VALUES ('', '$username', '$password')";
$result = mysqli_query($connection,$query);
if(!$result)
{
die("we have problem");
}
mysqli_close($connection);
?>
i am getting this error Warning: mysqli_connect(): (28000/1045): Access denied for user 'befirstw_intelli'@'s147.adk-media.com' (using password: YES) in /home/befirstw/public_html/connectimagedb.php on line 8
if you have any idea or any thing more required for php connectivity plz suggest
I check that $ sign in the password is creating problem in my case.Please Do not use $ or any other special Character that may create problem. In my case $ sign in password was creating problem
This could simply be caused by an incorrect password. In your $dbpass
, is the space at the end supposed to be there? That extra space before the close "
would add a space to the end of the password, causing it to be a different password.
I am wondering if you are opening a connection. I notice the line, where it is closing a connection but not sure if you have opened a connection? Where is is your execute statement for the Insert Query?
Thanks
来源:https://stackoverflow.com/questions/27601727/warning-mysqli-connect-28000-1045-access-denied-for-user