Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 280
  • Last Modified:

Error with MySQL

MySQL said:
#1045 - Access denied for user 'root'@'localhost' (using password: YES)


phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

I'm getting the above errors when I try to access my database via phpMyAdmin. This might be related to the other Drupal error (another question posted previously).

How can I resolve this?
1 Solution
This is definitely an error with the username/password you have set up for that database, sometimes having to do with the "allowed host" fields.

Be sure to create a username and password in MySQL for this database, and then give that user access to the database.

In phpMyAdmin I usually take a shortcut -- I go to the "add user" form and fill the information out. Then I click "Create a database of the same name and grant all permissions" or however it's worded.

The end result should be a database, a user with read/write access to that database, and a host (sometimes it's localhost, sometimes it's '%', sometimes IP addresses or hostnames) that is allowed to connect to the server.

If you have access to the command line then you can also do it this way:


Of course, you'll have to change out the username/password/database name. If you CREATE a database that already exists nothing really happens, but don't skip that step.

I don't have time to proof what I just wrote -- but I will be back online a bit later today.

Good luck!


P.S. I run into this problem all the time, usually because I forgot to do one of the steps. :)

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now