WordPress.org

Ready to get started?Download WordPress

Forums

Cannot connect to Database (5 posts)

  1. organicw
    Member
    Posted 6 years ago #

    Hi,

    Having just started with WordPress, I tried to access my WP-Admin but it stated "Error - invalid username". So, I set up a new user, added them to the DB and deleted the old user.

    The new user has all privileges but when logging in it states:

    "Error establishing a database connection
    This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at localhost. This could mean your host's database server is down.

    Are you sure you have the correct username and password?
    Are you sure that you have typed the correct hostname?
    Are you sure that the database server is running? "

    ...Should I have done something differently??

  2. ClaytonJames
    Member
    Posted 6 years ago #

    This either means that the username and password information in your wp-config.php file is incorrect or...

    - Most logical thing to check first-

    In the files that you uploaded to your server you will find one named wp-config-sample. Start by renaming this file to wp-config (if you have not already done so).

    Open the wp-config file and find the following (starts around line 3):

    define('DB_NAME', 'putyourdbnamehere'); // The name of the database

    define('DB_USER', 'usernamehere'); // Your MySQL username

    define('DB_PASSWORD', 'yourpasswordhere'); // ...and password

    Make sure the information that you entered for database name, the database user name, and that users password, are all identical to the db user, name, and pwd you set up in your database. Save the file and then upload it to your WordPress installation location and attempt to install again.

    You will also find a very nice outline of these steps located in the "readme" document in the WordPress file you downloaded. Opens up in your browser for easy reference.

  3. organicw
    Member
    Posted 6 years ago #

    Hi there

    Many thanks for your response.

    The file you are talkig about....is it the WP Config.php file I can see in file manager on my cPanel?

    I will try your guidance when I get back from work this evening as it seems to be clear what I need to do. Thanks for directing me to the ReadMe info as well

    I'm new to this so the help is really appreciated

    thanks

  4. thewritersmanifesto
    Member
    Posted 6 years ago #

    Yes it is. You obviously have already renamed that file to the right name, all you need to do now is to edit it and insert your 3 names as explained above by organicw

  5. dinzan
    Member
    Posted 6 years ago #

    do you have the cPanel username prefixed to your db name and db username ?

    Also, have you added the user to the db in mysql area in cPanel ?

Topic Closed

This topic has been closed to new replies.

About this Topic