简体   繁体   中英

Access denied for user ''@'localhost' (using password: NO) phpmyadmin

Actually I am new to php. I created login page using php .after clicking on submit button its showing

"Access denied for user ''@'localhost' (using password: NO)"

i am using amazon linux server. In that i can login with my username and password but using php script i cant connect to the my database

Here my dbconn.php scirpt

<?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或*,以便它可以接收来自您计算机的请求。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM