• Resolved ahmedhamza884

    (@ahmedhamza884)


    I accidentally delete my WordPress site. but fortunately, I have the back of DB and files. now I install the WordPress from zero and restore the DB and file in the main public_html folder but still get the error “Establishing a database connection”.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator James Huff

    (@macmanx)

    Are you sure that you have the correct MySQL database username and password in the wp-config.php file?

    Are you sure that you have typed the correct MySQL database hostname into the wp-config.php file?

    If yes to both, then you’ll need to contact your hosting provider’s support to ask why your database server is offline.

    1 Host Web

    (@1hostweb)

    Establishing a database connection. This only means you have the configuration file with the wrong credentials.
    Open the wp-config.php in the public_html folder and look for below sentences.

    // ** MySQL settings – You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define( ‘DB_NAME’, ‘databasename’ );
    /** MySQL database username */
    define( ‘DB_USER’, ‘databaseusername’ );
    /** MySQL database password */
    define( ‘DB_PASSWORD’, ‘password’ );

    Update the above records with the correct database name, database user name, and password. Make sure you have added the user and given the necessary permissions to the database. Once updated with correct credentials the site should open normally without giving any errors.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Restoring give database error’ is closed to new replies.