Error with MySQL

Posted on 2012-09-04
Last Modified: 2012-09-24
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?
Question by:sandshakimi
    1 Comment
    LVL 12

    Accepted 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

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now