close

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

Today We are Going To Solve SQLSTATE[HY000] [1045] Access denied for user ‘username’@’localhost’ (using password: YES) in Php. Here we will Discuss All Possible Solutions and How this error Occurs So let’s get started with this Article.

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

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

    To Fix SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: YES) Error just Set the socket. Here you have to just 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 Fix SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: YES) Error just Change 'localhost' to '127.0.0.1'. Just change 'localhost' to '127.0.0.1' and solve the error.

Solution 1 : Set the socket

Here you have to just set the socket:

unix_socket: /Applications/MAMP/tmp/mysql/mysql.sock

Solution 2 : Change ‘localhost’ to ‘127.0.0.1’

Just change ‘localhost’ to ‘127.0.0.1’ and solve the error.

Conclusion

So these were all possible solutions to this error. I hope your error has been solved by this article. In the comments, tell us which solution worked? If you liked our article, please share it on your social media and comment on your suggestions. Thank you.

Also Read These Solutions

Leave a Comment