How to fix "Error establishing a database connection" | WP Learning Lab

47
74



Grab Your Free 17-Point WordPress Pre-Launch PDF Checklist:

Grab your free 10-Point WP Security Checklist:

Error establishing database connection is a very common error that I bet every WordPress user has encountered at some point. Luckily the fix is very easy and there are two ways to fix it.

Nearly every time this error is caused by incorrect or incomplete database information in your wp-config.php file or no linking the database user to the database.

Let’s tackle the first one first.

Incorrect or incomplete database information in your wp-config.php

All you have to do here is double check your MySQL database name, database username and the database user password. Make sure the credentials you have in the wp-config.php match exactly to the ones you created.

If you’re not sure where to find the ones you created, log into your cPanel account.

Then click on MySQL databases. That will show you all the database in your hosting account. Find the correct on for the wp-config.php file you’re working on. Make sure the db name matches what’s in the file.

Then find the db username you have linked to that database and what’s in the wp-config.php file matches exactly what’s associated with your database.

If you don’t remember the password, or have it noted somewhere, you can generated a new password for the user and put that into the wp-config.php.

While you’re here, you can make sure that the second possible reason for the error is taken care of.

At the bottom of the MySQL database page you will be able to link the database user to the database. Make sure they are linked and the correct privileges are set. If you’re unsure of the proper privileges, choose them all.

Now save the db user to database association. Save the wp-config.php file you were updating.

Then go to the page that was generating the error establishing database connection error and reload that page. Everything should be working normally now.

I hope this information helps you! If you have any questions leave a comment below or ping me @WPLearningLab on Twitter.

————–

If you want more excellent WordPress information check out our website where we post WordPress tutorials daily.

Connect with us:

WP Learning Lab Channel:

Facebook:

Twitter:

Google Plus:

Pinterest:

Nguồn:https://danhnhan.vn/


https://danhnhan.vn/giai-tri

47 COMMENTS

  1. I updated my WordPress and apparently my database was deleted :S Is there a solution? I don't know if there's a way to create again the database or something, I don't have a backup of it, so perhaps I'm screwed. Your videos always have save me, thanks so much for this content!

  2. I noticed that everytime i try to add or edit something on my website, it gets cut off and then i get this error message, it useually disappears in a while, but it wastes a lot of time because i have to wait until i can use my website again , really boring.

  3. I'm running localhost with this same issue. Went to the database and did like you instructed and it works. Thank you so much. I didn't experience this issue with the same setup on other machines.

  4. Hi, When I install wp rocket speed up plugin into the WordPress & save changes, then it shows this database error. any reason for that, I am wired now. pls, help.

  5. I am really worried my website was completely normal I haven't worked on this for many days, but yesterday I open and it was normal. Today I got the error 408 timeout request and then later "Error establishing a database connection". Then later open normally. I check and I have this database username(like on your video). Can this happen again? I am worried because this site is for a client and he bought his hosting with a third company that doesn't give me full access to the admin panel, probably because they have many websites there. Just weird.

  6. hello sir
    actually I was used wordpress database reset after that it's showing

    """"""""Error establishing a database connection

    If your site does not display, please contact the owner of this network. If you are the owner of this network please check that MySQL is running properly and all tables are error free.

    Could not find site www.xxxxxxxxxx.info. Searched for table wp_blogs in database i5368684_wp1. Is that right?

    What do I do now? Read the bug report page. Some of the guidelines there may help you figure out what went wrong. If you’re still stuck with this message, then check that your database contains the following tables:

    wp_users

    wp_usermeta

    wp_blogs

    wp_signups

    wp_site

    wp_sitemeta

    wp_registration_log

    wp_blog_versions"""""""

    What can I do now????????????
    Please help me

  7. I've found some of your videos useful, but this one – Sorry, but this is not clear. The explanation of exactly how to select he correct database from many in a list, and then add a new user and password, and then tie that user & password to the wp-config.php file, was not made clear. In fact it seemed like you edited the video and cut out your voice for a second right when you were explaining how to add a new user.
    I have a older 2015 copy of my GoDaddy WP website which I'm trying to load into a new GoDaddy hosting account now, and although I followed all your well explained steps in your very good video on how to manually upload /reinstall a WP website, I still can't get the old site to link into the new installation of WordPress. I'll keep looking for a solution.

  8. How do I get to the CPanel? Please I need HELP! I'm getting an error message saying, Error establishing a database connection

  9. I realized my problem. I got a zip file from previous designer and realized he used long address(?) like http://….. instead of simply page name. So, it screws up everything on localhost. Is there any quick way to fix this ?

  10. Wow. You saved me. Somehow, my problem isn't yet gone, but got me a step closer. I was about to quit this job. Thank you !!!!

  11. Hello
    Actually in my sql database it is showing
    Create New Database
    Current Databases
    MySQL Users
    Add New User

    how to solve the issue

  12. Sir Help Me Please
    My Website Hqpoint.org get 5-10 times Error 502 Bad Gateway in a day after installing any plugin .^_^;
    please give me solution😅😅😅😅

  13. WOW works like a charm with just one click. the error occured after i deleted the contact form7 plugin from wordpress dashboard. still wondering why this happened. Pleaselet me know if u have any idea. Thanks

  14. brother i m using xampp localhost .. so my problem is I have copied my whole wordpress website folder from ftp server to Xampp localhost .. it is showing the same error . what should i do now .

  15. Thanks for sorting my problem. It was the 2nd step you describe in the text about assigning permissions that was causing my error. No other video seemed to mention that step…. Very relieved….

LEAVE A REPLY

Please enter your comment!
Please enter your name here