Keep getting "SQLSTATE[HY000] [1045]" despite database credentials and permissions being correct

by NikkiBdraws   Last Updated July 12, 2019 04:09 AM

I'm trying to install Magento 2.3.1 locally, and I keep running into this error when I adding the database. The problem is not the credentials. Everything I've read about this error implies it's a problem with the database name, user, or password. I've tried different databases and users - with and without passwords - and get the same result each time.

I was able to install Magento 2 once after uninstalling and reinstalling MAMP Pro. Then, I updated my PC, and the site was no longer working. Instead there was an error message telling me to view the details in the exceptions log. This is roughly how the first line of that log file said:

main.CRITICAL: exception 'PDOException' with message 'SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

I deleted those site files and tried installing Magento again, and I was back to getting that error message. I don't know what else to try. I'm not reinstalling MAMP Pro every time I restart my computer.

I have a somewhat unusual setup in that I use Windows 10 with MAMP Pro 4. I don't know if that has something to do with it.

Related Questions

Updated April 18, 2017 10:09 AM

Updated November 17, 2017 11:09 AM

Updated February 18, 2017 08:09 AM

Updated February 14, 2019 18:09 PM

Updated June 12, 2017 04:09 AM