{"id":954,"date":"2014-10-28T07:54:36","date_gmt":"2014-10-28T07:54:36","guid":{"rendered":"https:\/\/cpanelplesk.com\/wp62\/?p=954"},"modified":"2021-02-16T10:06:16","modified_gmt":"2021-02-16T10:06:16","slug":"error-establishing-a-database-connection-in-wordpress","status":"publish","type":"post","link":"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/","title":{"rendered":"Error Establishing a Database Connection in WordPress"},"content":{"rendered":"<p><a href=\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2.jpg\"><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-960\" src=\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2.jpg\" alt=\"Error2\" width=\"678\" height=\"97\" srcset=\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2.jpg 678w, https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2-300x43.jpg 300w\" sizes=\"(max-width: 678px) 100vw, 678px\" \/><\/a><br \/>\n<span style=\"color: #000000;\">If you have been browsing the web for a while, you have seen this error a few times. Error Establishing a Database Connection is one of those errors that could be due to different causes. As a WordPress beginner, this could be awfully annoying exclusively when it occurred on its own without you modifying anything. We ran into this issue last night on our own website. It took over 30 minutes to identify and fix the issue.<\/span><br \/>\n<span style=\"color: #000000;\">Previously we have fixed the errors like<\/span> <a title=\"WordPress Posts Returning 404 Error\" href=\"https:\/\/cpanelplesk.com\/wp62\/wordpress-posts-returning-404-error\/\">WordPress posts returning 404 Error<\/a>\u00a0<span style=\"color: #000000;\">and\u00a0<\/span><a title=\"WordPress: White Screen of Death\" href=\"https:\/\/cpanelplesk.com\/wp62\/wordpress-white-screen-of-death\/\">WordPress: White Screen of Death<\/a>\u00a0.<br \/>\n<span style=\"color: #000000;\"> In this post, we will explain to you those steps which we have take to fix the error establishing a database connection in WordPress.<\/span><br \/>\n<span style=\"color: #000000;\">The error message is clear that your website is unable to connect to the database.This error can occur due to different reasons.<\/span><br \/>\n<strong>Wrong Connection Parameters:<\/strong><br \/>\n<span style=\"color: #000000;\">The most common reason, having wrong database credentials will cause the error. These credentials are in the wp-config.php file placed in the main directory for your WordPress. There are three credentials: data source name, database user, and database security password.Make sure these credentials match the details located in your cPanel.<\/span><\/p>\n<div class=\"command-sh\">\n<pre class=\"lang:default decode:true \">define('DB_NAME', 'database-name');\r\ndefine('DB_USER', 'database-username');\r\ndefine('DB_PASSWORD', 'database-password');\r\ndefine('DB_HOST', 'localhost');<\/pre>\n<\/div>\n<p><span style=\"line-height: 1.5; color: #000000;\">If you know the current database username and password, you can reset it. If you do not know it, you will not be able to check the current password, so you will need to remove and then recreate the database user, by giving the same password in the wp-config.php file. If this was the issue, then the error should be fixed and the website will be good.<\/span><br \/>\n<strong>Database\u00a0Corrupted:<\/strong><br \/>\n<span style=\"color: #000000;\">If you have verified the credentials are ok and still getting the error, the problem could be due to corrupted database tables. Database tabels can be checked and repaired from cPanel. Follow the instruction in our article<\/span> <a title=\"Optimize and Repair all MySQL databases in WHM\" href=\"https:\/\/cpanelplesk.com\/wp62\/toptimize-and-repair-all-mysql-databases\/\">How to repair crashed tables through phpMyAdmin<\/a>\u00a0.<br \/>\n<strong>Too Many Concurrent Database Connections:<\/strong><br \/>\n<span style=\"color: #000000;\">This error can also occur if there are too many connections to your database at once,In this case you can handle it by enabling cache plugins on your websites.This will limit the overall database connection on your WordPress site.<\/span><br \/>\n<span style=\"color: #000000;\">In our case issue was with database credentials, we have reset them and website start working.Hope these solutions will also work for you.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have been browsing the web for a while, you have seen this error a few times. Error Establishing a Database Connection is one of those errors that could be due to different causes. As a WordPress beginner, this could be awfully annoying exclusively when it occurred on its own without you modifying anything. [&#8230;]<\/p>\n<p><a class=\"understrap-read-more-link\" href=\"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/\">Continue Reading&#8230;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,13],"tags":[],"class_list":["post-954","post","type-post","status-publish","format-standard","hentry","category-cpanel","category-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Error Establishing a Database Connection in WordPress - cPanel Plesk<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Error Establishing a Database Connection in WordPress - cPanel Plesk\" \/>\n<meta name=\"twitter:description\" content=\"If you have been browsing the web for a while, you have seen this error a few times. Error Establishing a Database Connection is one of those errors that could be due to different causes. As a WordPress beginner, this could be awfully annoying exclusively when it occurred on its own without you modifying anything. [...]Continue Reading...\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Seemab Saleem\" \/>\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:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/\"},\"author\":{\"name\":\"Seemab Saleem\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/73d573cc7eaaf6625cf0dbd72191a648\"},\"headline\":\"Error Establishing a Database Connection in WordPress\",\"datePublished\":\"2014-10-28T07:54:36+00:00\",\"dateModified\":\"2021-02-16T10:06:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/\"},\"wordCount\":386,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13\"},\"image\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2.jpg\",\"articleSection\":[\"Cpanel\",\"WordPress\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/\",\"name\":\"Error Establishing a Database Connection in WordPress - cPanel Plesk\",\"isPartOf\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2.jpg\",\"datePublished\":\"2014-10-28T07:54:36+00:00\",\"dateModified\":\"2021-02-16T10:06:16+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#primaryimage\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2.jpg\",\"contentUrl\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2.jpg\",\"width\":678,\"height\":97},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cpanelplesk.com\/wp62\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Error Establishing a Database Connection in WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#website\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/\",\"name\":\"cPanel Plesk\",\"description\":\"Blog on famous hosting control panels\",\"publisher\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cpanelplesk.com\/wp62\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13\",\"name\":\"Farooq Omer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png\",\"contentUrl\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png\",\"width\":300,\"height\":44,\"caption\":\"Farooq Omer\"},\"logo\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/73d573cc7eaaf6625cf0dbd72191a648\",\"name\":\"Seemab Saleem\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6a87ff2e53b03e6839250e5278a6bd46?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6a87ff2e53b03e6839250e5278a6bd46?s=96&d=mm&r=g\",\"caption\":\"Seemab Saleem\"},\"description\":\"Linux Server Administrator, Web Hosting engineer. I'm dealing with Linux servers since 2014. I started this blog to share the work i love with the world . let me know if you need any assistance. Thanks!!\",\"sameAs\":[\"https:\/\/cpanelplesk.com\/wp62\"],\"url\":\"https:\/\/cpanelplesk.com\/wp62\/author\/cmb\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Error Establishing a Database Connection in WordPress - cPanel Plesk","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:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/","twitter_card":"summary_large_image","twitter_title":"Error Establishing a Database Connection in WordPress - cPanel Plesk","twitter_description":"If you have been browsing the web for a while, you have seen this error a few times. Error Establishing a Database Connection is one of those errors that could be due to different causes. As a WordPress beginner, this could be awfully annoying exclusively when it occurred on its own without you modifying anything. [...]Continue Reading...","twitter_image":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2.jpg","twitter_misc":{"Written by":"Seemab Saleem","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#article","isPartOf":{"@id":"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/"},"author":{"name":"Seemab Saleem","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/73d573cc7eaaf6625cf0dbd72191a648"},"headline":"Error Establishing a Database Connection in WordPress","datePublished":"2014-10-28T07:54:36+00:00","dateModified":"2021-02-16T10:06:16+00:00","mainEntityOfPage":{"@id":"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/"},"wordCount":386,"commentCount":1,"publisher":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13"},"image":{"@id":"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#primaryimage"},"thumbnailUrl":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2.jpg","articleSection":["Cpanel","WordPress"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/","url":"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/","name":"Error Establishing a Database Connection in WordPress - cPanel Plesk","isPartOf":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#primaryimage"},"image":{"@id":"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#primaryimage"},"thumbnailUrl":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2.jpg","datePublished":"2014-10-28T07:54:36+00:00","dateModified":"2021-02-16T10:06:16+00:00","breadcrumb":{"@id":"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#primaryimage","url":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2.jpg","contentUrl":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2014\/10\/Error2.jpg","width":678,"height":97},{"@type":"BreadcrumbList","@id":"https:\/\/cpanelplesk.com\/wp62\/error-establishing-a-database-connection-in-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cpanelplesk.com\/wp62\/"},{"@type":"ListItem","position":2,"name":"Error Establishing a Database Connection in WordPress"}]},{"@type":"WebSite","@id":"https:\/\/cpanelplesk.com\/wp62\/#website","url":"https:\/\/cpanelplesk.com\/wp62\/","name":"cPanel Plesk","description":"Blog on famous hosting control panels","publisher":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cpanelplesk.com\/wp62\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13","name":"Farooq Omer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/","url":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png","contentUrl":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png","width":300,"height":44,"caption":"Farooq Omer"},"logo":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/"}},{"@type":"Person","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/73d573cc7eaaf6625cf0dbd72191a648","name":"Seemab Saleem","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6a87ff2e53b03e6839250e5278a6bd46?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6a87ff2e53b03e6839250e5278a6bd46?s=96&d=mm&r=g","caption":"Seemab Saleem"},"description":"Linux Server Administrator, Web Hosting engineer. I'm dealing with Linux servers since 2014. I started this blog to share the work i love with the world . let me know if you need any assistance. Thanks!!","sameAs":["https:\/\/cpanelplesk.com\/wp62"],"url":"https:\/\/cpanelplesk.com\/wp62\/author\/cmb\/"}]}},"_links":{"self":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/posts\/954","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/comments?post=954"}],"version-history":[{"count":0,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/posts\/954\/revisions"}],"wp:attachment":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/media?parent=954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/categories?post=954"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/tags?post=954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}