cancel
Showing results for 
Search instead for 
Did you mean: 

PDOException: SQLSTATE[HY000] [1045] Access denied for user

SOLVED

PDOException: SQLSTATE[HY000] [1045] Access denied for user

Any idea about hiding this message?
After mysql restart sometimes i have public this error and my database password is visible!

 

2019-05-13 14_51_40-Mozilla Firefox.png

1 ACCEPTED SOLUTION

Accepted Solutions

Re: PDOException: SQLSTATE[HY000] [1045] Access denied for user

@VETO SA 
What is your deployment mode?

In the developer mode error shows publicly on browser, if you use default or production mode, then error will shown in reporting file or like this
An error has happened during application run. See exception log for details. Could not write error message to log. Please use developer mode to see the message. 
you can change this message as well...

I will suggest to use production mode if site is already live. It will also improve the site performance.

View solution in original post

4 REPLIES 4

Re: PDOException: SQLSTATE[HY000] [1045] Access denied for user

@VETO SA 
Please make sure that you have proper access for the database connection, which you are using for magento. 

Check once app/etc/env.php for Database user name, password and database name.

Re: PDOException: SQLSTATE[HY000] [1045] Access denied for user

Vimal the problem here isn't the access. I created the issue by adding wrong password on my mysql connection.


The problem here is that the error is visible to public. I want to hide error like this. Is critical security issue. Like when your mysql server is down you will get the same error and everyone will get your mysql password!!!

Re: PDOException: SQLSTATE[HY000] [1045] Access denied for user

@VETO SA 
What is your deployment mode?

In the developer mode error shows publicly on browser, if you use default or production mode, then error will shown in reporting file or like this
An error has happened during application run. See exception log for details. Could not write error message to log. Please use developer mode to see the message. 
you can change this message as well...

I will suggest to use production mode if site is already live. It will also improve the site performance.

Re: PDOException: SQLSTATE[HY000] [1045] Access denied for user

@Vimal Kumar  thank you for your prompt reply!


My deploy:mode:set was production and seems that something went wrong at the upgrade from MC 2.2 to MC 2.3!

On clean fresh installation Magento 2.3 works as you described. Probably i missconfigured something on magento. I will re-install all my plugins and i will check also if there is any bug.