hOW To Fix Error Establishing a Database Connection Print

  • hOW To Fix Error Establishing a Database Connection
  • 0

  • Check wp-config.php: Verify the database name, username, password, and host are correct:

    define('DB_NAME', 'your_database_name');
    define('DB_USER', 'your_username');
    define('DB_PASSWORD', 'your_password');
    define('DB_HOST', 'localhost');
  • Test Database Connection: Use a simple PHP script to confirm the database credentials:

    <?php
    $link = mysqli_connect('localhost', 'username', 'password', 'database');
    if (!$link) {
        die('Could not connect: ' . mysqli_error());
    }
    echo 'Connected successfully';
    ?>
  • Contact Hosting Support: If the credentials are correct but the error persists, your database server might be down.


 


Was this answer helpful?

« Back