Register Now


Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Add question


Register Now

Thank you for registering with WPTricks

How To Fix “Error Establishing A Database Connection” In WordPress

Learn how to fix “Error Establishing A Database Connection” on your WordPress blog!

Blog post:

Linked mentioned:

Like us on Facebook:

Comments ( 30 )

  1. can you tell how i can change the wordpress link like this /wp-content/uploads/2019/10/daniel-korpai-r73OFSry5AI-unsplash-tunespam-Chat.jpg

  2. Hola!!..When I tried to access the ftp file, I got this message:
    Under Construction
    The site you were trying to reach does not currently have a default page. It may be in the process of being upgraded.
    Please help!!

  3. Thanks, Sir! it really worked in my case

  4. I am indebted to you. I faced this issue in my website but that video helped me a lot in order to recover my website. Thumbs up and keep up the good work.

  5. I liked your role in GOT. Say hello to John Snow from me.

  6. Thank you so much! This happened to me today and I followed your instructions and all is good now! Again, thanks! Great video!

  7. One more thing can cause this error that is updating PHP version in "cpanel" (may be in other hosting provider also). As I update version from 5.6 to 7.3 of PHP cause this error and updating takes time near about 15 minutes (may take upto 30 minutes depends on site).

  8. I am using localhost on my Mac. I tested php and MySQL and they are all working great. maint/repair didn't work, and all the data is correct.

  9. Thank you Monsieur Firehose. (Thank god for slow down feature.) But seriously, very concise and to the point. I knew most of that, but good to have it all in one vid, especially for those who don't know.

  10. Hi chaps, ..

    I still haven't sorted out my localhost XAMPP issue, but a few things have poped up when trying out the above examples.

    Firstly: PHP v5.5.0 scrapped, or depreciated the mysql_connect() function, and it seems that PHP 7 hasn't got the equivalent, .. I call that bullcrap.

    After a lot of precious precocious digging: mainly coming off of the many precocious precious programmers out there, all humming and arring as they are wont do; then I've discovered that mysql (i) can be used instead. Note the [ i ] in the new function, and you can forget all that confusing blurb that goes on about PDO-functions, especially if all you want to do is test the bloomin' thing.

    Also: the example shown in connecting to your database was — $test Connection, — when in fact it's $testConnection — (no space.)

    Here's the code, ..


    $testConnection = mysqli_connect( 'localhost', 'root', 'password' );

    if( !$testConnection ) {

    die( 'Error: ' . mysql_error() );

    echo 'Database Connection is working! ..';

    mysqli_close ($testConnection);


    Running it tells me that I can connect to my database, but I still can't get XAMPP to load my web-pages.
    Note: not a new install, .. it was working fine last night, .. then it wasn't today.

    My journey continues .. hope the above helps.

  11. I Dont get it, I Got the error on Xbox one downloading minecraft mods, Its not my website Annnnnnddddddd i got no pc

  12. Corrige seu USUÁRIO que você criou no Banco de dados do Mysql.
    change your USER information you created in the Mysql Database.
    ALTER USER ‘Usuario’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘SENHA-DO-USUÁRIO’;
    SEGUE O LINK das informações no site do mysql.
    FOLLOW THE LINK of the information on the mysql website.

    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 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?

    If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

  14. thanks for your help it did work as you said

  15. how to access wp-config.php file? I am not even able to login into admin. and FTP. it gave me an error "Unable to read the indexed puredb file (or old format detected) – Try pure-pw mkdb" not even to able login wp-admin. it showing the same error esablishing a database connection error to me. i am using goggie host provider hosting account they haven't given me any answer. can you help me .

  16. I get this when I hit localhost/mywbsite before im even able to install my wp site.

  17. Bro same problem in Android
    Please tell me how to solve it

  18. Error establishing a database connection The Chewy

  19. Error establishing a database connection The Chewy

  20. Error establishing a database connection The Chewy

  21. Error establishing a database connection The Chewy

  22. Hey thanks man!!
    Wonderful video
    I am really impressed to see that you have provided such an interesting information about WordPress.
    I was struggling with the same issue since last 3 days and finally solved it. Anyways can you suggest me some better option to get cheap linux hosting other than

  23. Thanks a lot dear. Really Good video. You tell us a lot of information about this topic. I also write an article on this issue on my blog

Leave a reply