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']

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

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.

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

Thank you
Anant Prajapati
Magento Certified Developer

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

Use  DB host = 127.0.0.1  instead of localhost 

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

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

Thank you! I was really stuck on this then I realized that the auto generated password put a $ symbol in it.

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

Good spot - quoting the password makes no difference. How on earth is this not flagged in the setup guide!? All passwords should include special characters!!

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

My information base secret word has unique characters, however I didn't get away from the uncommon characters in my secret phrase.

By adding an oblique punctuation line before the extraordinary characters (! # ' " ' and ; and $), I had the option to run the order effectively. Trust that it can help you assuming your data set secret word has extraordinary characters. Much obliged to you.

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

i am using xampp and having the same issue.what should i do now?