Forbrukslån på Dagen | Paras näppäimistö | Test av Kredittkort 2017 | Strømpriser 2017 | Tyverialarm | Betalingsforsikring | Billigste Mobilabonnement | Verdivurdering av Bolig på Nett
wordpress

How to fix Establish Database Connection in WordPress

Establish Database Connection in WordPress

hi gusy, wordpress using php, mysql and more language.

If you have been surfing the web for a while, you have at least seen this error a few times. Error Establishing a Database Connection is one of those curses that could be caused by many reasons. As a WordPress beginner, this could be awfully frustrating specially when it happened on its own without you changing anything. We ran into this issue yesterday on our own site. It took a little over 20 minutes to detect and fix the problem. While doing the research to find possible causes, we realized that there was no good article that covered everything. In this article, we will show you how to fix the error establishing a database connection in WordPress by compiling a list of solutions all in one place.

Note: Before you make any database changes, make sure you have sufficient backups.

Establish Database Connection

wordpress calling there current database that was installed via wordpress installation. it’s look like a php website, you need to have idea about MySQL Database Connection. wordpress call there database when it going working. but if you have the database problem it can’t connect with there database also. below i was shared a code that give you idea about how to connect wordpress with there database.

above code php calling the database with host, username and password. a example below.

above code i was added my Database UserName $username = “my_dbname”; so here “my_dbname” is my database and and $password = “my_dbpass”; here “my_dbpass” is my database password. when you are getting the Establish a Database Connection Notice from your wordpress site, think that can’t relation with mysql database. so, now we need a solution that how to fix the establish database connection in wordpress.

How To Fix Establish Database Connection

First thing you should do is to make sure that you are getting the same error on both the front-end of the site, and the back-end of the site (wp-admin). If the error message is the same on both pages “Error establishing a database connection”, then proceed onto the next step. If you are getting a different error on the wp-admin for instance something like “One or more database tables are unavailable. The database may need to be repaired”, then you need to repair your database.

You can do this by adding the following line in your wp-config.php file. Add it just before ‘That’s all, stop editing! Happy blogging’ line wp-config.php.

now go to this url http://mywordpresswebsite.com/wp-admin/maint/repair.php. replace your sitename editing from mywordpresswebsite.com then you can see a page look like below.

simply click on Repair Database Button. and Remember, the user does not need to be logged in to access this functionality when this define is set. This is because its main intent is to repair a corrupted database, Users can often not login when the database is corrupt. So once you are done repairing and optimizing your database, make sure to remove this from your wp-config.php.

Hope Your Database Problem Will Be Solved. but if your database can’t be fix, contact with your hosting provider or go to your hosting panel and open config.php file from public_html. then Copy Past Your Correct Database Details from First of code like below.

hope your problem was solved…. any questions or thanks simply give your feedback from comment form. thanks.

Comments

comments

About the author

Toriqul Islam Tusher

বলার মত কিছু নাই!

Leave a Comment