Sep 20, 2018

ERROR ESTABLISHING A DATABASE CONNECTION FIX

If you are a publisher or simply loves to blog using different hosting sites and if you happen to accidentally messed up with some urls definitely you will fail to access your cPanel.

Aside from failure to access the cPanel your ongoing blog or site you are creating will not be accessible.

Helping out a friend who is using 000webhost.com to create his website (free hosting) just accidentally overwrite the default given urls.

Here's the quick fix in case you encounter the same error and need not panic as long as you haven't deleted the database from your free web hosting site.

If you wish to try this free web hosting site like blogger to create your own site with WordPress then you may sign up for free, just click on image below to be directed to site.
https://www.000webhost.com/1008461.html
free web hosting
Here you can build website by installing WordPress
build website
website builder

Going back to our main concern on how to fix the error on establishing a database connection. This is how it looked like of the given error when trying to access your account.
error establishing a database connection
wp-admin_access
This was the part in settings which caused the error after the modification, so never try to mess with this part if you don't have a domain yet.
WordPress address
WordPress Address_Site Address
Let's just set an example of a default address say https://myblog.000webhostapp.com is your default WordPress Address (URL) and Site Address (URL) when using 000webhost.com

Now you happen to accidentally changed to https://myblog.com both in WordPress Address (URL) and Site Address (URL) which we can easily fix by going to your web host provider at 000webhost.com, other providers may be using HostGator, GoDaddy will also have access to the database.

Simply log in to your account and check on "manage database" tab to access the PhpMyAdmin section.
phpadmin
manage database

Once you are inside phpMyAdmin  click on the WordPress website you want to modify and select wp_options and simply edit the siteurl and home option values and input the original or correct url address https://myblog.000webhostapp.com and click go button when you're done.
phpMyAdmin
wp_options_modify
Sample editing under 'siteurl' option value, same step to make on 'home'
phpMyAdmin
input the correct url and click go button_do the same with home
From your browser type in https://myblog.000webhostapp.com to check if it's already working. If it does not fix the problem we will try to access the file manager tab from your web host provider.

file manager
select file manager
Click on upload files now
upload files now
click on upload
Simply scroll and look for wp_config.php and open
wp_config.php
wp_config.php
Double check the DB Name and DB User if the same from your database including the password
wp_config.php
DB Name_DB User_DB Password_DB Host
If you are not sure about the DB password you can simply set a new password and paste it from wp_config.php usually it comes with a long code like this one (see sample below) when you try to access the config.

'd4701989587d576b8d03bd7998bd804a3507cb5a'

To be sure just go back to manage database and change password and copy that to wp_config.php
manage database change password
changing password for database
You may set your own password of your own choice and don't forget to copy and replace the long default password generated from your database.

paste the new password
double check data if the same
Once you are done, try to access your cPanel in WordPress or try again your URL if it won't show you errors.

So far this fix worked as long as your database is not corrupted. Hope this will help out those building their website via WordPress regardless of web hosting provider used.

Until next post...

Share with friends if you found this helpful.

Cheers!

No comments:

Post a Comment

#