Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected Exception: SQLSTATE[HY000] [1045] Access denied for user ****@'localhost' (using password: YES)

An application was handed to me by an old colleague to manage. However, whenever I try to run it, I keep getting this error. Please any help would do.

enter image description here

like image 543
segdavids Avatar asked Jul 30 '14 08:07

segdavids


4 Answers

Sometimes Access denied Exception Error because your mysql credentials are invalid. Secondly, from my experience i observed that this also happens because you did not set password to your database connectivity. eg

private $host = "localhost";
private $db_name = "db_dbtest"; // Database name
private $username = "db_user"; // your database username
private $password = "db_password"; // Your password
public $conn;

}

Try and set password to your database connectivity. I had such experience and after changing my Collation to utf8_general_ci on the Operations tab, this could not solve my problem. I thought of adding password to my database connection and immediately it connected. You can tesrun this and see if it helps.

like image 126
Basil Nzewure Avatar answered Nov 02 '22 17:11

Basil Nzewure


You're getting Access denied Exception Error because your mysql credentials are invalid.

like image 41
Suraj Kumar Adhikari Avatar answered Nov 02 '22 17:11

Suraj Kumar Adhikari


This is due to the wrong sql information provided by you.Changing it to the right one can solve this error .

like image 2
Avinash Babu Avatar answered Nov 02 '22 19:11

Avinash Babu


I was getting this same error code. I'm using phpMyAdmin and added the database with the import of a sql file. The website was using all the same code that had worked before. To fix this error go inside phpMyAdmin and click on the database then operations tab. Change the collation of my database to "ut8_general_ci". Afterwards it was able to verify the username/password access to the database.

Also you might want to make sure you added the user accounts tab the username,password and privileges to access the database.

like image 1
Gary Kluth Avatar answered Nov 02 '22 17:11

Gary Kluth