[英]Access denied for user ''@'localhost' (using password: NO) phpmyadmin
Actually I am new to php. 其实我是php新手。 I created login page using php .after clicking on submit button its showing 我使用php创建登录页面。单击“提交”按钮后,其显示
"Access denied for user ''@'localhost' (using password: NO)" “拒绝访问用户“ @'localhost”(使用密码:否)”
i am using amazon linux server. 我正在使用Amazon Linux服务器。 In that i can login with my username and password but using php script i cant connect to the my database 因为我可以使用我的用户名和密码登录,但是使用php脚本我无法连接到我的数据库
Here my dbconn.php
scirpt 这是我的dbconn.php
脚本
<?php
class UserValue{
private $SERVER;
private $HostName;
private $Db_UserID;
private $Db_Password;
private $Database;
function __construct($HostName, $Db_UserID, $Db_Password, $Database){
$this->HostName = '*****';
$this->Db_UserID = '****';
$this->Db_Password = '****';
$this->Database = '****';
$this->SERVER = $_SERVER[HTTP_HOST];
if ($this->SERVER !== 'www.******.com') die("Entered incurrect Hostname!!!");
$connect = mysql_connect($this->HostName, $this->Db_UserID, $this->Db_Password);
if (!$connect) die('Could Not Connect to '.$this->HostName.' throwing error'.mysql_error());
$db_conn = mysql_select_db($this->Database);
if (!$db_conn) die('Could Not Connect to '.$this->Database.' throwing error'.mysql_error());
}
}
?>
please help me how to fix this issue 请帮我解决这个问题
创建时需要在数据库服务器中添加IP或*,以便它可以接收来自您计算机的请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.