cancel
Showing results for 
Search instead for 
Did you mean: 

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

Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost' (using password: YES)

Please compare your root password with the password which you have give in your app/etc/env.php file, Thanks !! db => [connection' => ['default' => ['password' => 'password']
Highlighted

Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost' (using password: YES)

Please compare your root password with the password mentioned in the app/etc/env.php file, Thanks
Highlighted

Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost' (using password: YES)

My database password has special characters, but I didn't escape the special characters in my password.

By adding a backslash before the special characters (! # ' " ` & ; and $), I was able to run the command successfully. Hope that it can help you if your database password has special characters. Thank you.

Highlighted

Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost' (using password: YES)

Hello @jason_long 

 

Can you please confirm that you import DB uses any DEFINER in any table??? 

 

For checking this you need to export the db by 

mysqdump -u<username> -p<password> <db_name> > db_name.sql

 

Then Run below command

grep -rnw ./db_name.sql -e 'DEFINER' 

 

if you get any return value than run below command 

 

sed -i 's/DEFINER=`root`@`localhost`/ /g' db_name.sql

 

This command will replace your DEFINER root to NULL so, you can access with the current Database user.

 

If my answer is useful, please Accept as Solution & give Kudos

Highlighted

Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost' (using password: YES)

Use  DB host = 127.0.0.1  instead of localhost 

Highlighted

Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost' (using password: YES)

I am facing same issue and i am using xxamp kindly guide me.I am stuck magento installing process last 3 days. if you can guide me so please guide whole installation process from 1 to 10 Thank You