Warning: mysqli_connect(): (28000/1045): Access denied for user [duplicate]

眉间皱痕 提交于 2019-12-02 22:36:20

问题


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


回答1:


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




回答2:


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.




回答3:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!