{"id":255392,"date":"2019-06-24T13:56:47","date_gmt":"2019-06-24T17:56:47","guid":{"rendered":"https:\/\/wpdeveloper.net\/?p=255392"},"modified":"2019-07-21T03:00:45","modified_gmt":"2019-07-21T07:00:45","slug":"database-connection-error","status":"publish","type":"post","link":"https:\/\/wpdeveloper.com\/database-connection-error\/","title":{"rendered":"How to Fix the Establishing Database Connection Error in WordPress"},"content":{"rendered":"<p>The Database Connection Error is one of the most common issues that WordPress users have to deal with. It leads to your entire website going down. Sounds frightening, right? Well, despite so, this problem can easily be resolved in just a few minutes. So, there&#8217;s nothing to be paranoid about! Let&#8217;s take a deep dive into what normally causes it and how you can quickly get rid of this <strong>Establishing Database Connection Error<\/strong> in WordPress.<!--more--><\/p>\n<h2><span style=\"color: #3366ff\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-276322 size-full\" src=\"https:\/\/wpdeveloper.net\/wp-content\/uploads\/2019\/06\/How-to-fix-the-Establishing-Database-Connection-Error-in-WordPress.png\" alt=\"\" width=\"1280\" height=\"720\" title=\"\" srcset=\"https:\/\/assets.wpdeveloper.com\/2019\/06\/How-to-fix-the-Establishing-Database-Connection-Error-in-WordPress.png 1280w, https:\/\/assets.wpdeveloper.com\/2019\/06\/How-to-fix-the-Establishing-Database-Connection-Error-in-WordPress-600x338.png 600w, https:\/\/assets.wpdeveloper.com\/2019\/06\/How-to-fix-the-Establishing-Database-Connection-Error-in-WordPress-768x432.png 768w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><\/span><\/h2>\n<h2><span style=\"color: #3366ff\">Possible Reasons Why &#8216;Establishing Database Connection Error&#8217; can Occur<\/span><\/h2>\n<p>Before we discuss how the <strong>Database Connection Error<\/strong> can occur, let&#8217;s give you an idea what this is all about. Briefly, you will encounter this when your WordPress website is unable to communicate with your Database. As a result, your site wouldn&#8217;t be able to retrieve all the stored data &amp; information. This leads to your website going down and showing this error.<\/p>\n<p>The reasons for this Database Connection Error can actually vary. There are a few key factors which can cause this problem on your website. For instance, if the login credentials of your Database is incorrect or changed, your WordPress site will no longer be able to connect to the MySQL database. Besides, you can face this issue if your database or files get corrupted as well. In the meantime, too much traffic on your website can lead to your database becoming unresponsive. So, the server side errors can also cause the <strong>Database Connection Error<\/strong>.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-263106\" src=\"https:\/\/wpdeveloper.net\/wp-content\/uploads\/2019\/06\/Error-Database-Connection.png\" alt=\"database connection error\" width=\"894\" height=\"516\" title=\"\" srcset=\"https:\/\/assets.wpdeveloper.com\/2019\/06\/Error-Database-Connection.png 894w, https:\/\/assets.wpdeveloper.com\/2019\/06\/Error-Database-Connection-600x346.png 600w, https:\/\/assets.wpdeveloper.com\/2019\/06\/Error-Database-Connection-768x443.png 768w\" sizes=\"(max-width: 894px) 100vw, 894px\" \/><\/p>\n<h2><span style=\"color: #3366ff\">Effective Ways to Fix the Database Connection Error<\/span><\/h2>\n<p>We have already talked about how you might face the <strong>Database Connection Error<\/strong> on your WordPress website. Without further ado, let&#8217;s now focus on the most popular ways you can fix this horrible error.<\/p>\n<p><strong>Please Note that, <\/strong>before you make any of these following changes, make sure to create a backup of your entire WordPress website.<\/p>\n<h2><span style=\"color: #3366ff\">Check Login Credentials of Your Database<\/span><\/h2>\n<p>Mismatch of your Database Login Credentials is the most common reasons why users come across the <strong>&#8216;Database Connection Error&#8217;<\/strong> message. For instance, After you have changed the root username or password of your Database from the Server and forgot to apply the changes in the wp-config.php file, then you will obviously encounter this problem.<\/p>\n<p>To check the <strong>wp-config.php<\/strong> file, you will simply just have to go to the cPanel or FTP server. Afterward, from the <strong>WordPress Directory<\/strong>, you will get access to this file. It contains four key information which needs to be in a correct order to establish a connection with your Database: Name, Username, Password &amp; Hostname of the MySQL Database. You will have to make sure that all the key data are the same as they are in the server. If they are not, simply just modify the credential information as per your server and save the changes.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-263148\" src=\"https:\/\/wpdeveloper.net\/wp-content\/uploads\/2019\/06\/screely-1560077020566.png\" alt=\"database connection error\" width=\"832\" height=\"808\" title=\"\" srcset=\"https:\/\/assets.wpdeveloper.com\/2019\/06\/screely-1560077020566.png 832w, https:\/\/assets.wpdeveloper.com\/2019\/06\/screely-1560077020566-600x583.png 600w, https:\/\/assets.wpdeveloper.com\/2019\/06\/screely-1560077020566-768x746.png 768w\" sizes=\"(max-width: 832px) 100vw, 832px\" \/><\/p>\n<h2><span style=\"color: #3366ff\">Fix Corrupted Files<br \/>\n<\/span><\/h2>\n<p>Due to corrupted Plugin or Theme files, WordPress websites can fail to establish a connection to the database as well. For some unfortunate circumstance, if you fail to update a plugin successfully, then you are likely to face such an error on your website. It can happen after even successfully updating a Plugin or Theme due to internal conflicts as well.<\/p>\n<p>Well, there&#8217;s a quick turnaround to troubleshoot this problem. Simply just access your WordPress Directory from your cPanel File Manager or FTP server. Inside that, you will locate the <strong>&#8216;wp-content&#8217;<\/strong> folder. Once you are inside it, you can simply just rename the Plugins folder by adding a <strong>&#8216;-&#8216;<\/strong>. Then, you can go back to your website and check back whether everything&#8217;s normal or not.<\/p>\n<p>If it is the case, make sure to change the Plugins folder to its original name and then, go inside the folder. Afterward, simply just find the culprit by checking back &amp; forth by renaming every one of the Plugins you have got. Once you have found which Plugin was causing the error, you can simply just delete it or contact their support team regarding this.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-263315\" src=\"https:\/\/wpdeveloper.net\/wp-content\/uploads\/2019\/06\/screely-1560096611223.png\" alt=\"database connection error\" width=\"750\" height=\"362\" title=\"\" srcset=\"https:\/\/assets.wpdeveloper.com\/2019\/06\/screely-1560096611223.png 750w, https:\/\/assets.wpdeveloper.com\/2019\/06\/screely-1560096611223-600x290.png 600w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<h2><span style=\"color: #3366ff\">Repair Corrupted Database<\/span><\/h2>\n<p>Sometimes even your Database itself can get corrupted and will lead to the Database Connection Error in your WordPress website. Since the plugins or the themes on your website are constantly tweaking with the Database tables, it is not unlikely to encounter such an issue. Even though it will sound very terrifying, you can easily troubleshoot this by following these below instructions:<\/p>\n<p>WordPress gives you the opportunity to easily initiate a <strong>&#8216;Database Repair&#8217;<\/strong> mode. Like all the other solutions mentioned above, you will have to access the <strong>&#8216;wp-config.php&#8217;<\/strong> file for this case as well. Simply just add this following line of code in the last line of the file and save changes:<\/p>\n<pre><code>define('WP_ALLOW_REPAIR', true);<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-263334\" src=\"https:\/\/wpdeveloper.net\/wp-content\/uploads\/2019\/06\/screely-1560099497397.png\" alt=\"database connection error\" width=\"1010\" height=\"774\" title=\"\" srcset=\"https:\/\/assets.wpdeveloper.com\/2019\/06\/screely-1560099497397.png 1010w, https:\/\/assets.wpdeveloper.com\/2019\/06\/screely-1560099497397-600x460.png 600w, https:\/\/assets.wpdeveloper.com\/2019\/06\/screely-1560099497397-768x589.png 768w\" sizes=\"(max-width: 1010px) 100vw, 1010px\" \/><\/p>\n<p>After you have successfully completed the previous step, you can simply just go to this following link (use your own domain instead of example): https:\/\/example.com\/wp-admin\/maint\/repair.php As soon as you have hit the link, you will then be prompted to <strong>&#8216;Repair Database&#8217;<\/strong>.<\/p>\n<p>Once you have hit the &#8216;Repair Database&#8217; button, your Database will be restored automatically. After the process is finished, make sure to remove the code you have inserted in the previous step from the wp-config.php file. Afterward, you can check back to your website and you should no longer see the <strong>Database Connection Error<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-263332\" src=\"https:\/\/wpdeveloper.net\/wp-content\/uploads\/2019\/06\/screely-1560098732480.png\" alt=\"database connection error\" width=\"850\" height=\"552\" title=\"\" srcset=\"https:\/\/assets.wpdeveloper.com\/2019\/06\/screely-1560098732480.png 850w, https:\/\/assets.wpdeveloper.com\/2019\/06\/screely-1560098732480-600x390.png 600w, https:\/\/assets.wpdeveloper.com\/2019\/06\/screely-1560098732480-768x499.png 768w\" sizes=\"(max-width: 850px) 100vw, 850px\" \/><\/p>\n<h2><span style=\"color: #3366ff\">Final Thoughts<\/span><\/h2>\n<p>After detecting the cause of the <strong>Database Connection Error<\/strong>, you can easily solve it by following the respective approach as we have mentioned. In this article, we have only talked about the most usual cases which lead users to face this horrendous issue. So, if you face anything unique or need further assistance, you should definitely contact your Hosting Provider regarding it.<\/p>\n<p>If you need help on another highly common WordPress problem, then you can also check out our blog on <a href=\"https:\/\/wpdeveloper.net\/fix-max-filesize-elementor\/\" target=\"_blank\" rel=\"noopener\"><strong>how to solve Maximum File size Exceeding error<\/strong><\/a>.<\/p>\n<p>So, what do you think about this article? Have you found it helpful? Feel free to leave your feedback in the Comments section.<\/p>\n\t\t<div data-elementor-type=\"section\" data-elementor-id=\"295085\" class=\"elementor elementor-295085\" data-elementor-post-type=\"elementor_library\">\n\t\t\t\t\t<section data-particle_enable=\"false\" data-particle-mobile-disabled=\"false\" class=\"elementor-section elementor-top-section elementor-element elementor-element-45857f9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"45857f9\" data-element_type=\"section\" data-e-type=\"section\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-8f322c1\" data-id=\"8f322c1\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-693dda77 elementor-widget elementor-widget-text-editor\" data-id=\"693dda77\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Will You Recommend Our Plugin To Your Friends?<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4e8e6d8e elementor-align-center elementor-widget elementor-widget-button\" data-id=\"4e8e6d8e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm elementor-animation-grow\" href=\"https:\/\/www.facebook.com\/pg\/WPDeveloperNet\/reviews\/\" target=\"_blank\" rel=\"noopener\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">If Yes, Kindly Leave a Review on Facebook<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t\n","protected":false},"excerpt":{"rendered":"<p>Sometimes, WordPress websites fail to communicate with the Database of your server. This can lead to your entire website going down. So, you will have to perform an immediate action to resolve it. You can easily do this by checking your Database Login Credentials or any File and Database Corruptions.<\/p>\n","protected":false},"author":6348,"featured_media":276322,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","inline_featured_image":false,"_eb_data_table":"","footnotes":""},"categories":[88,434],"tags":[634,635,141,89,502],"class_list":["post-255392","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-wordpress","tag-database-connection-error","tag-database-connection-error-wordpress","tag-tips-and-tricks","tag-wordpress","tag-wordpress-error"],"nelio_content":{"autoShareEndMode":"never","automationSources":{"useCustomSentences":false,"customSentences":[]},"efiAlt":"","efiUrl":"","followers":[2045,6348],"highlights":[],"isAutoShareEnabled":true,"networkImageIds":[],"permalinkQueryArgs":[],"series":[],"suggestedReferences":[]},"views":2697,"_links":{"self":[{"href":"https:\/\/wpdeveloper.com\/wp-json\/wp\/v2\/posts\/255392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpdeveloper.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpdeveloper.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpdeveloper.com\/wp-json\/wp\/v2\/users\/6348"}],"replies":[{"embeddable":true,"href":"https:\/\/wpdeveloper.com\/wp-json\/wp\/v2\/comments?post=255392"}],"version-history":[{"count":27,"href":"https:\/\/wpdeveloper.com\/wp-json\/wp\/v2\/posts\/255392\/revisions"}],"predecessor-version":[{"id":295186,"href":"https:\/\/wpdeveloper.com\/wp-json\/wp\/v2\/posts\/255392\/revisions\/295186"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpdeveloper.com\/wp-json\/wp\/v2\/media\/276322"}],"wp:attachment":[{"href":"https:\/\/wpdeveloper.com\/wp-json\/wp\/v2\/media?parent=255392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpdeveloper.com\/wp-json\/wp\/v2\/categories?post=255392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpdeveloper.com\/wp-json\/wp\/v2\/tags?post=255392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}