- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost'
Hi all,
I'm banging my head against the wall trying to figure out what I did wrong. I've created a database and a user, but when I run the installation, I get the following error.
And yes, I checked and rechecked the password a thousand times. I'm hoping one of you kind souls can point out my obvious mistake.
Sigh... I'll just keep checking the password until I hear back...
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost'
1. Check that DB grant all permission.
2. Check your host is same or different.
3. Check the database allocated to the particular user or not.
mysql -u [username] -p (using command prompt)
4. show Databases (In that list check your DB exist or not)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost'
As you can see from the screenshot, I've done all those things. Unless I'm
missing something. Please double check me!
1. The screenshot shows that all privileges have been granted ("GRANT ALL
PRIVILEGES").
2. The screenshot shows that 'localhost' is used in all places
("'magento'@'localhost'"
and "db-name=localhost")
3. The screenshot shows that the user 'magento'@'localhost' has all
privileges on magento.* . Using the command prompt, I AM ABLE to log in as
magento, using my specified password.
4. Yes, when logged in via command prompt, and I do 'show databases;', I
see the magento database.
Again, thanks for all your help!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost'
The user "root" doesn't have permission to access your database from that IP. I recommend creating a user specifically for Magento
Follow these steps: SQLSTATE[HY000] [1045] Access denied for user
I hope it helps!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost'
think I might be? Thanks!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost'
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost'
Thank you, @Vimal Kumar . I did try putting 127.0.0.1 in the command line arguments, with no luck. Do you mean to say I need to edit the env.php file? And can you explain the difference between using 127.0.0.1 and localhost?
Either way, I won't be able to test it right way because...
UPDATE: I was able to work around the issue by using the Setup Wizard instead. It had no issues connecting to the database using the credentials I provided.
However, even though I found a workaround, I would like to keep the discussion going. There is no reason (in my opinion) that the command line method would not work. Is there an argument I got wrong? Is there a permissions issue? What system user (as opposed to database user) does the Setup Wizard use to access the database? I'm guessing it's not the 'magento' user that I used to execute the command line command.
Thoughts? Thanks for your input!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost'
I mean to edit env.php and add 127.0.0.1 there instead of localhost.
127.0.0.1 is the ip address of localhost.
Some server unable to connect db using localhost, but it works using ip 127.0.0.1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost'
If you have special character on password then add back slash, for example if your password is admin$33^p then write password as admin\$33\^p this will work
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost'
@kmrafiq wrote:If you have special character on password then add back slash, for example if your password is admin$33^p then write password as admin\$33\^p this will work
This worked for me!
Thanks a lot!