To Check your database login details in wp-config

How the database login details could have suddenly stopped working! Things like switching hosting companies or changing anything about your database name or user information could cause the error if your wp-config file wasn’t updated with the new information.

Log into your cPanel and open the File Manager. Look for a file called wp-config.php in the directory of installed WordPress. Then go ahead and open that for editing.

You’ll see the login credentials for your database, probably near the top of the file. It should look something like this:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME''database_name_here' );
/** MySQL database username */
define( 'DB_USER''username_here' );
/** MySQL database password */
define( 'DB_PASSWORD''password_here' );
/** MySQL hostname */
define( 'DB_HOST''localhost' );

As you can see, there are four lines of information WordPress needs to access your database:

  1. The name of the database (“DB_NAME”)
  2. The login username (“DB_USER”)
  3. The login password (“DB_PASSWORD”)
  4. The database host (“DB_HOST”)

If any of these values is incorrect, WordPress will not be able to connect to the database. Then it shows the Error “Error establishing a database connection”.

Tagged in:

, ,