How to Fix the Error Establishing a Database Connection in WordPress

How to Fix the Error Establishing a Database Connection in WordPress


Is your site getting the error
establishing a database connection in WordPress? Well keep watching I’ll show
you several different troubleshooting techniques that you can use to fix this
problem. When we had to do this for our site it
took about 20 minutes so go ahead and give yourself a little bit of time to
work through these. You’ll also want to make sure that you have an FTP client so that
you can connect to your website from the back end. You can get your login
credentials from your hosting provider. So this is what it will look like, first
thing you want to do is make sure that you get an error from the front end as
well as the back end when you try and access your admin area. If you get
something like this then you’ll want to try and repair the database to do that
connect to your website with your FTP client, scroll down, and we’re looking for
our WP config file. We want to download this locally and then you can open it
with a text editor, any text editor will do. I have notepad plus plus so I’ll use
that. You want to scroll all the way down to below “that’s all stop editing” and
start a new line and we want to paste this bit of code in there. This will
allow it to try and repair the database so we need to save that and upload it
back to our site. So go back to the FTP client, click upload, you want to
overwrite this once you add that bit of code head over to this URL and click
repair and optimize database and that should fix it. If you’re still getting
the error establishing database connection like you see here then we’ll move on to
the next step. The next thing we want to do is go back to our wp-config file and
we want to make sure that all of our information is correct
specifically all of the database information. Once you verify that
everything looks ok and if you’ve seen any issues that you’ve made changes to
then go ahead and upload it and try it again. If you still see the error then
you can change your DB_host from localhost to
the actual IP address, that works for some people especially people who are
running the local server environment so you can try that and then finally you
want to check your web host MySQL server. If your site gets inundated with
a lot of traffic then basically your server just can’t handle the requests so
that might be what’s happening as well. This will require you to contact your
support for your host and see if they can help you out with that. Once you’ve
identified and fixed anything with your wp-config file go back and see if it
works again. Your site should come back up. Did you learn something from today’s
video? If so subscribe to our YouTube channel and we’ll send more helpful tips
to help you manage your WordPress website and thanks for watching

21 thoughts on “How to Fix the Error Establishing a Database Connection in WordPress”

Leave a Reply

Your email address will not be published. Required fields are marked *