{"id":2754,"date":"2013-06-04T14:22:14","date_gmt":"2013-06-04T18:22:14","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2013\/06\/04\/error-establishing-database-connection\/"},"modified":"2022-02-23T11:42:34","modified_gmt":"2022-02-23T16:42:34","slug":"error-establishing-database-connection","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/","title":{"rendered":"WordPress &#8220;Error Establishing a Database Connection&#8221;"},"content":{"rendered":"<p>While the &#8220;<em>Error Establishing a Database Connection<\/em>&#8221; is a fairly common error, troubleshooting it can take a few different routes. This article will explain the error and go over the different causes and fixes.<\/p>\n<h2>What is the &#8220;Error Establishing a Database Connection&#8221; error?<\/h2>\n<p>This error means that your WordPress script either cannot locate the database, or is being refused the ability to connect to the database.<\/p>\n<h2>What causes this error?<\/h2>\n<p>This error can occur due to a few different causes, each one is described along with recommended solution.<\/p>\n<h3>Incorrect connection parameters<\/h3>\n<p>By far the most common, having incorrect connection credentials will cause the error. These credentials are located in the wp-config.php file found in the root folder for your WordPress installation. There are three credentials: <em>database name<\/em>, <em>database user<\/em>, and <em>password<\/em>. Make sure these match the information located in your cPanel. If you know the current database user password, you can <a href=\"\/support\/edu\/cpanel\/reset-database-password\/\">reset it<\/a>. If you do not know it, you will not be able to view the current password, so you will need to delete and then <a href=\"\/support\/edu\/cpanel\/create-database-user\/\">recreate the database user<\/a>, giving it the password found in the <em>wp-config.php<\/em> file. If this is the issue, then the problem should be solved and the site should display normally<\/p>\n<h3>Corrupted database tables<\/h3>\n<p>If you have confirmed the credentials are correct and still get the error, the issue could be caused by corrupted database tables. Database tables can be checked and repaired from within the cPanel. Follow the instructions from our article below to perform the repair.<\/p>\n<ul>\n<li><a href=\"\/support\/website\/check-repair-database\/\">How to Check and Repair a Database<\/a><\/li>\n<\/ul>\n<h3>Too many concurrent database connections<\/h3>\n<p>The error can also occur if there are too many connections to your database at once. Currently, the default limit for our servers is 30 connections at once. If this is your issue, you can certainly curb it by enabling caching plugins on your website. This will limit the overall number of database interactions your WordPress site performs.<\/p>\n<p>We have several articles to assist you with this. These are listed below.<\/p>\n<ul>\n<li><a href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/plugins\/w3-total-cache\/\">Optimizing WordPress with W3 Total Cache plugin<\/a><\/li>\n<li><a href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/plugins\/wp-super-cache\/\">Optimizing WordPress with WP Super Cache Plugin<\/a><\/li>\n<\/ul>\n<p>Additionally, there can be other causes for extraneous database interaction. These can be prevented by <a href=\"\/support\/edu\/wordpress\/log-out-of-admin-dashboard-when-not-in-use\/\">logging out of WordPress admin dashboard when not in use<\/a>, <a href=\"\/support\/edu\/wordpress\/disable-wordpress-autosave\/\">disabling the WordPress autosave<\/a>, and <a href=\"\/support\/edu\/wordpress\/limit-or-disable-wordpress-revisions\/\">limiting or disabling WordPress revisions<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While the &#8220;Error Establishing a Database Connection&#8221; is a fairly common error, troubleshooting it can take a few different routes. This article will explain the error and go over the different causes and fixes. What is the &#8220;Error Establishing a Database Connection&#8221; error? This error means that your WordPress script either cannot locate the database,<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/\"> Read More ><\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4335,56],"tags":[],"class_list":["post-2754","post","type-post","status-publish","format-standard","hentry","category-error-numbers","category-wordpress"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Error Establishing a Database Connection in WordPress<\/title>\n<meta name=\"description\" content=\"Learn how to fix the &quot;Error establishing database connection&quot; in WordPress.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Error Establishing a Database Connection in WordPress\" \/>\n<meta property=\"og:description\" content=\"Learn how to fix the &quot;Error establishing database connection&quot; in WordPress.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2013-06-04T18:22:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-23T16:42:34+00:00\" \/>\n<meta name=\"author\" content=\"Scott Mitchell\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Scott Mitchell\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/\"},\"author\":{\"name\":\"Scott Mitchell\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed\"},\"headline\":\"WordPress &#8220;Error Establishing a Database Connection&#8221;\",\"datePublished\":\"2013-06-04T18:22:14+00:00\",\"dateModified\":\"2022-02-23T16:42:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/\"},\"wordCount\":393,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Website Error Numbers\",\"WordPress Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/\",\"name\":\"Error Establishing a Database Connection in WordPress\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2013-06-04T18:22:14+00:00\",\"dateModified\":\"2022-02-23T16:42:34+00:00\",\"description\":\"Learn how to fix the \\\"Error establishing database connection\\\" in WordPress.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress &#8220;Error Establishing a Database Connection&#8221;\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed\",\"name\":\"Scott Mitchell\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/scott\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Error Establishing a Database Connection in WordPress","description":"Learn how to fix the \"Error establishing database connection\" in WordPress.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/","og_locale":"en_US","og_type":"article","og_title":"Error Establishing a Database Connection in WordPress","og_description":"Learn how to fix the \"Error establishing database connection\" in WordPress.","og_url":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2013-06-04T18:22:14+00:00","article_modified_time":"2022-02-23T16:42:34+00:00","author":"Scott Mitchell","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Scott Mitchell","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/"},"author":{"name":"Scott Mitchell","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed"},"headline":"WordPress &#8220;Error Establishing a Database Connection&#8221;","datePublished":"2013-06-04T18:22:14+00:00","dateModified":"2022-02-23T16:42:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/"},"wordCount":393,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Website Error Numbers","WordPress Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/","url":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/","name":"Error Establishing a Database Connection in WordPress","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2013-06-04T18:22:14+00:00","dateModified":"2022-02-23T16:42:34+00:00","description":"Learn how to fix the \"Error establishing database connection\" in WordPress.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/error-establishing-database-connection\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"WordPress &#8220;Error Establishing a Database Connection&#8221;"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed","name":"Scott Mitchell","url":"https:\/\/www.inmotionhosting.com\/support\/author\/scott\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/2754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=2754"}],"version-history":[{"count":4,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/2754\/revisions"}],"predecessor-version":[{"id":84562,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/2754\/revisions\/84562"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=2754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=2754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=2754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}