Database Error

    Error Database

    "Error establishing a database connection"

    This error means WordPress cannot connect to your MySQL database.

    First Step: Check wp-config.php

    Open the file wp-config.php at your WordPress root and check these lines:

    define('DB_NAME', 'database_name');

    define('DB_USER', 'username');

    define('DB_PASSWORD', 'password');

    define('DB_HOST', 'localhost');

    Database Error Causes

    Incorrect Credentials

    Connection info in wp-config.php is incorrect.

    Check DB_NAME, DB_USER, DB_PASSWORD, DB_HOST

    MySQL Server Down

    Your host's MySQL service is temporarily unavailable.

    Contact your host or wait

    Corrupted Database

    Database tables are corrupted or damaged.

    Repair tables via phpMyAdmin or WP-CLI

    Incorrect Table Prefix

    The prefix in wp-config.php doesn't match the tables.

    Check $table_prefix in wp-config.php

    Repair a Corrupted Database

    1

    Enable WordPress Repair

    Add define('WP_ALLOW_REPAIR', true); in wp-config.php then access /wp-admin/maint/repair.php

    2

    Repair via phpMyAdmin

    Select your database, check all tables and choose 'Repair'.

    3

    Use WP-CLI

    Run wp db repair to automatically fix tables.

    Complex Database Problem?

    Our experts can diagnose and repair your WordPress database without data loss.

    Call an Expert