close

[Solved] SQLSTATE[HY000] [1045] Access denied for user ‘username’@’localhost’ (using password: YES)

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error SQLSTATE[HY000] [1045] Access denied for user ‘username’@’localhost’ (using password: YES) in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How SQLSTATE[HY000] [1045] Access denied for user ‘username’@’localhost’ (using password: YES) Error Occurs?

Today I get the following error SQLSTATE[HY000] [1045] Access denied for user ‘username’@’localhost’ (using password: YES) in php.

How To Solve SQLSTATE[HY000] [1045] Access denied for user ‘username’@’localhost’ (using password: YES) Error ?

  1. How To Solve SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: YES) Error ?

    To Solve SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: YES) Error If you use MAMP, you might have to set the socket: unix_socket: /Applications/MAMP/tmp/mysql/mysql.sock

  2. SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: YES)

    To Solve SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: YES) Error If you use MAMP, you might have to set the socket: unix_socket: /Applications/MAMP/tmp/mysql/mysql.sock

Solution 1

Check Following Things

  • Make Sure You Have MySQL Server Running
  • Check connection with default credentials i.e. username : ‘root’ & password : ” [Blank Password]
  • Try login phpmyadmin with same credentials
  • Try to put 127.0.0.1 instead localhost or your lan IP would do too.
  • Make sure you are running MySql on 3306 and if you have configured make sure to state it while making a connection

Solution 2

If you use MAMP, you might have to set the socket: unix_socket: /Applications/MAMP/tmp/mysql/mysql.sock

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment