if you've just seen this error when
trying to visit your wordpress site do
not worry because in this video we're
going to look at a few solutions to how
we can solve it and get your site back
up and running
[Music]
hey my name's ryan i'm from wpbeginner
and i completely understand how
frustrating this error can be none of
the solutions in this video may seem a
little technical but please do not worry
because we're going to go through it
step by step and all the resources and
links are in the description below now
before we get into the solution let's
look what causes this issue now this is
a pretty common problem when someone
tries to move their website from one
host to another or install another
instance of wordpress and there are
three things that can cause this error
one you have incorrect database
information in your wordpress settings
two the database is corrupt or three
there is an issue with your database
server at this point you're probably
asking what is the database and what's
that got to do with wordpress well
wordpress is a content management system
and wordpress uses a database to store
your content and website data
when a user visits your website
wordpress then connects to the database
and shows them the content wordpress
needs a few things to connect to the
database it needs a database name it
needs a database username it needs a
database password and a database server
wordpress stores all this information in
a wordpress configuration file or a wp
config file
now if any of the information in that wp
config file is incorrect wordpress can't
connect to the database now that brings
us nicely to our first method so method
one is to check your database
information to do that we need to find
our wp-config file and check the
information in it there are a couple
methods we can use to access the file we
can either use an ftp client or a file
manager through our hosting control
panel for this video i'm going to make
it nice and easy and use a file manager
through my hosting control panel but if
you want to use an ftp client there is a
link to a fantastic article that'll help
you get set up with an ftp client ok
when you're ready we'll jump right in
once you've logged into your hosting
dashboard you need to look for the file
manager in bluehost it's under the
advanced tab and then we can find the
file manager under the file section here
click on that
that's going to open up a new tab
and what we're looking for is the public
underscore html folder and then we need
to scroll to find the wp config file
once you've found the wp config file
right click on it and download it to
your computer so i've downloaded
wp-config file and opened it in the
simple text editor to find the
information that we need now i've
blanked out some of this information for
this video but the information we're
looking for is right here database
settings database name database username
and database password now we need to
double check these with our hosting
control panel so we're going to go back
over to the hosting control panel go
back to the advanced tab and what we're
looking for this time is the mysql
databases which is right here under
databases now again some of this
information is blanked out but
essentially you'll be able to find this
information if you're looking under your
mysql databases so right here we have
current databases so we have the
database name the database username and
if we scroll down from here
we can see the current usernames
and actions we can change the password
so we can change the password and then
go back to our wp config file and put
the new password in here
so just double check all this
information is same as what you have in
your my sql databases
and then upload it to your website
method two is to check your database
host information
most wordpress hosting companies use
localhost for your database host but
some don't so the best thing to do is to
contact your hosting provider and ask
for that information
method three is to repair our wordpress
database if you see a different error
message when you try and access the back
end and log into your website then
you'll need to repair your wordpress
database to do this open up your wp
config file in your text editor again
scroll to the bottom of the page
find this line that's all stop editing
happy publishing above that just insert
this line of code which is available in
the description below save that file
then come back over into your file
manager
find the original wp config file
delete that
and then go to upload
select the wp-config file that you've
just edited
and then visit this link
this can also be found in the
description just make sure you change
your site.com to your actual site url
click on repair and optimize database
just so you know this may take a while
when you can access the site go back and
remove the line of code from your wp
config file
now if you've got this far in the video
and all your information seems to be
correct but your website's still
throwing up an error
our fourth method is to check whether
our database server is down this can
happen if your site experiences heavy
traffic and your server can't handle the
amount of visitors at that point your
website will seem really really slow and
it may throw up the error to some users
the best course of action is to contact
your hosting company and ask if your
mysql server is down
if you want to check for yourself then
follow these steps let's jump right in
head back to the hosting dashboard and
find the file manager and click on that
make sure we're under the public html
folder
and create a file called
testconnection.php
make sure that's saved under the public
html folder
and create a new file
scroll down to the file
and click on edit that file
now you want to paste the following
lines of code
and before we save this we want to
change the username and the password to
the username and password for our
database click save changes
after you've done that try and connect
to the script using the following link
again just change the url to your
website url if the script connected
successfully then it means that your
user has sufficient permission and there
is something else that is wrong go back
to your wp config file to make sure that
everything there is correct
i really hope this video is able to help
you out and get your site back up and
running
but if the solutions in this video
didn't work then the next thing you
should do is ask for some help the first
thing i would do is reach out to your
hosting provider and ask if they can
help troubleshoot the issue
some really good hosting providers will
even solve the problem for you another
thing you can do is contact a wordpress
developer now we recommend going through
codeable as they're professional trusted
and they have wordpress developers on
there that can help you out for a
reasonable price
if you want more tips on fixing
wordpress errors then check this video
out
thanks for watching