Showing Error SQLSTATE[HY000] [1045] Access denied

Posted June 10, 2021 736 views
NginxUbuntuMySQLPHPLEMPUbuntu 20.04

I have gone through the tutorial and done the exact but my when I try to open in website it is showing Error!: SQLSTATE[HY000] [1045] Access denied for user ‘user’@'localhost’ (using password: YES)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there @riyastp04,

Are you using the correct password for your connection string in your website configuration file?

Did you get any errors when you ran the CREATE USER query:

CREATE USER 'example_user'@'%' IDENTIFIED WITH mysql_native_password BY 'password';

Also, did you run the grant privileges query too:

GRANT ALL ON example_database.* TO 'example_user'@'%';