• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » Fix Sudden Error Establishing a Database Connection WordPress

By Abhishek Ghosh April 6, 2014 10:37 pm Updated on April 6, 2014

Fix Sudden Error Establishing a Database Connection WordPress

Advertisement

Fix Sudden Error Establishing a Database Connection in WordPress By Following Our Logical Flow Chart Without Taking Much Sudden Headache. Causes of Sudden Headaches are not really great ! We are talking about fixing the typical appearance of white page declaring Error Establishing a Database Connection in WordPress all of a sudden in a five minutes ago working great website. This is not for those who could never establish a Database Connection or getting MySQL Gone Away Error. Many years ago we published an article – Tips to Optimize WordPress Running on Dedicated Server, although with time; the links or tips are not fully applicable now anymore but actually the basic issue is with resource allocation to MySQL database.

 

Error Establishing a Database Connection WordPress : For Those Who Has No Idea About Technical Parts

 

Those who has no idea about SQL, MySQL, PHPMyAdmin or what type of web hosting you are using, it is better to take someone other’s help. Usually your web hosting company’s support will work fine. Do not try to experiment on trial and error basis.

 

Fix Sudden Error Establishing a Database Connection WordPress

 

This typical error usually appears when working on your site or making some changes and sometimes side by side published a new post; suddenly you see the dreaded white page with the error message “Error Establishing a Database Connection”. Usually it happens with One Server running both MySQL Server and Apache2 / Ngnix Web Server Software. It is rare for 2 or multiple server setup. If you are using a server without a web hosting control panel (like Rackspace Cloud Server, Amazon or MediaTemplate’s high end servers), the fix is usually to SSH as root and simply restart MySQL server :

Advertisement

---

Vim
1
sudo /etc/init.d/mysql restart

Then restart Apache or perform a full reboot :

Vim
1
2
3
4
# restart apache
/etc/init.d/apache2 restart
# reboot
reboot

Usually error will go away. Reasons can be many, but usually it happens due to buggy plugins.
If the situation is to bad and a reboot does not solve, open your wp-config.php file and add at the bottom :

Vim
1
define('WP_ALLOW_REPAIR', true);

If you point your browser towards your website’s this url :

Vim
1
http://www.yoursite.com/wp-admin/maint/repair.php

you will be able to repair the corrupted database. It is important to double check the database details (unlikely they will be wrong – since 5 minutes ago they were working nicely). Sometime’s with wrong chmod value, deactivating W3 Total Cache like plugin can make the whole wp-config.php white – instead of deleting one single line, it fully deletes all the lines. This is why we suggest to change the ownership of wp-config.php to root instead of giving it to Apache (www-data) and chmod it to as low value as possible so that no Plugin can overwrite it.

Actually you need to optimize your WordPress installation and most importantly, tweak MySQL Server to perform better. If you have recently migrated, you can try to run this SQL command (edit the statements, url etc.) :

Vim
1
UPDATE YOUR DATABASE NAME.wp_options SET option_value = 'http://YOURURL' WHERE wp_options.option_id =2 LIMIT 1 ;

Fix Sudden Error Establishing a Database Connection WordPress

Plesk, cPanel, Webmin etc. web software usually will run normally (if installed), so as Apache, PHP.
Plesk, cPanel, Webmin are more related to Perl than MySQL. GoDaddy, Bluehost etc. shared, VPS face these errors due to inadequate allocated resource. Try to upgrade to better web host which are standard now like Rackspace, Amazon, HP Cloud etc. It is not that, you’ll never get Sudden Error Establishing a Database Connection on these hosts, but actually you can allocate more resource to MySQL server or use a Database as a Service. Primarily it happens out of a protective mechanism to prevent destruction of the data saved on database. With sudden spike of increased need of RAM for MySQL (just to make it simple), MySQL Server stops to execute anything.
Once you saw it, use some web software to monitor up time and ping you when the server is not working properly. Not all service will give alert for MySQL errors.

Tagged With error establishing a database connection , error connecting database , mysql gone error , cant establish database connection , error establishing a database connection sudden , error establishing a ms sql server database connection wp-config php , How to Fix the Error Establishing a Database Connection in WordPress

This Article Has Been Shared 398 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Fix Sudden Error Establishing a Database Connection WordPress

  • Server Colocation : What should you must look for

    Server Colocation center choosing is an important step for any person or organization seeking for Server Colocation.Several points needs to be checked before.

  • Repairing WordPress Database : Using Cloud Database Server

    Repairing WordPress Database is easy by using Cloud Database Server like from The Rackspace Cloud which provides MySQL database server with PHPmyAdmin software.

  • Using https URL of Rackspace Cloud Files for WordPress

    Using https URL of Rackspace Cloud Files for WordPress needs some extra steps for more secured delivery of Static Content of your SSL enabled WordPress site.

  • Making WordPress to Load Faster on Rackspace Cloud Sites

    Making WordPress to Load Faster on Rackspace Cloud Sites needs WP Super Cache,CDN Sync Tool, HyperDB, .htaccess tricks and tweaks to make buggy plugins working.

  • Professional Business Cards : People Will Keep Your Card

    Professional Business Cards is an asset for any professional. It should be promotive and informative but must have something that will prevent to throw away.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is an Automatic Ethanol Fireplace February 8, 2023
  • Disadvantages of Cloud-Native Computing February 7, 2023
  • Projector Screen Basics February 6, 2023
  • What is Configuration Management February 5, 2023
  • What is ChatGPT? February 3, 2023

About This Article

Cite this article as: Abhishek Ghosh, "Fix Sudden Error Establishing a Database Connection WordPress," in The Customize Windows, April 6, 2014, February 9, 2023, https://thecustomizewindows.com/2014/04/fix-sudden-error-establishing-database-connection-wordpress/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT