{"id":25929,"date":"2018-11-12T07:41:34","date_gmt":"2018-11-12T07:41:34","guid":{"rendered":"https:\/\/www.awardspace.com\/?page_id=25929"},"modified":"2024-02-28T07:24:00","modified_gmt":"2024-02-28T07:24:00","slug":"error-establishing-database-connection","status":"publish","type":"post","link":"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/","title":{"rendered":"How to Fix the Error Establishing a Database Connection in WordPress"},"content":{"rendered":"<p>The following tutorial provides detailed information about the <strong>Error Establishing a Database Connection<\/strong> message in WordPress, including meaning and a few possible methods to fix it.<\/p>\n<p>&nbsp;<\/p>\n<h3>What Does the Error Mean?<\/h3>\n<p>If you are a website administrator and own a <a href=\"\/wordpress-hosting\/\">WordPress Hosting<\/a> account, you have probably come across the <strong>Error Establishing a Database Connection<\/strong> error at some point. The message itself is a bit generic and does not give enough information about the root cause of the problem. However, what it means is that WordPress is encountering a problem while attempting to connect to its associated database.<\/p>\n<p>The image illustrated below will give you a better idea and understanding of the warning.<\/p>\n<p><a class=\"et_pb_lightbox_image\" title=\"error establishing database connection\" href=\"\/wp-content\/uploads\/2018\/10\/error-establishing-database-connecton-1.png\" data-featherlight=\"image\"> <img decoding=\"async\" class=\"size-full wp-image-15434 aw-border-img\" src=\"\/wp-content\/uploads\/2018\/10\/error-establishing-database-connecton-1.png\" alt=\"error establishing a database connection in wordpress\" \/> <\/a><\/p>\n<p>Below, we&#8217;ve compiled a list of known solutions to the database connection issue that every WordPress administrator and end-user may encounter.<\/p>\n<p>&nbsp;<\/p>\n<h3>Solution #1: Check the wp-config.php file<\/h3>\n<p>If you have recently performed changes to your MySQL database via your Database Manager (such as modifying the password of your database) or your hosting account has been moved to a different server, then you will need to update the file <strong>wp-config.php<\/strong> as well.<\/p>\n<p><strong>wp-config.php<\/strong> (also known as the main configuration file) is probably the most important file in every WordPress system. It stores essential and sensitive information regarding your blog, such as the database connection settings and the security keys.<\/p>\n<p><a class=\"et_pb_lightbox_image\" title=\"error establishing database connection\" href=\"\/wp-content\/uploads\/2018\/11\/error-establishing-database-connecton-2.png\" data-featherlight=\"image\"> <img decoding=\"async\" class=\"size-full wp-image-15434 aw-border-img\" src=\"\/wp-content\/uploads\/2018\/11\/error-establishing-database-connecton-2.png\" alt=\"error establishing a database connection in wordpress 2\" \/> <\/a><\/p>\n<p>Open up the configuration file (it should be located in the root directory of your domain\/sub-domain name). Once in the editor, look for the following four variables in your PHP code:<\/p>\n<ul>\n<li><strong><code>define('DB_NAME')<\/code><\/strong><\/li>\n<li><strong><code>define('DB_USER')<\/code><\/strong><\/li>\n<li><strong><code>define('DB_PASSWORD')<\/code><\/strong><\/li>\n<li><strong><code>define('DB_HOST')<\/code><\/strong><\/li>\n<\/ul>\n<p>Double-check all four variables defined in the code and ensure that they match the database settings available in your Database Manager.<\/p>\n<p><a class=\"et_pb_lightbox_image\" title=\"error establishing database connection\" href=\"\/wp-content\/uploads\/2018\/11\/error-establishing-database-connecton-3.png\" data-featherlight=\"image\"> <img decoding=\"async\" class=\"size-full wp-image-15434 aw-border-img\" src=\"\/wp-content\/uploads\/2018\/11\/error-establishing-database-connecton-3.png\" alt=\"error establishing a database connection in wordpress 3\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>Solution #2: Repair the database<\/h3>\n<p>There are times when a database may become corrupt or damaged. Database corruption usually occurs as a result of a faulty or badly configured WordPress theme or plugin.<\/p>\n<p>If you happen to receive an <strong>Error Establishing a Database Connection<\/strong> error, you can try to resolve the issue by repairing the MySQL database associated with your WordPress instance.<\/p>\n<p>Performing a database repair is seamlessly easy and can be done in four steps:<\/p>\n<ol>\n<li>Sign in to your AwardSpace account.<\/li>\n<li>Once logged in, navigate to the <a href=\"https:\/\/cp1.awardspace.net\/beta\/database-manager\/\">MySQL Manager<\/a> page inside your dashboard.<\/li>\n<li>Locate the database that is linked to your WordPress site and click on the <strong>Options<\/strong> icon.<\/li>\n<li>Open the <strong>Management<\/strong> tab and press the <strong>1-click Repair<\/strong> button.<\/li>\n<\/ol>\n<p><a class=\"et_pb_lightbox_image\" title=\"error establishing database connection\" href=\"\/wp-content\/uploads\/2018\/11\/error-establishing-database-connecton-4.png\" data-featherlight=\"image\"> <img decoding=\"async\" class=\"size-full wp-image-15434 aw-border-img\" src=\"\/wp-content\/uploads\/2018\/11\/error-establishing-database-connecton-4.png\" alt=\"error establishing a database connection in wordpress 4\" \/> <\/a><\/p>\n<p>Now that you&#8217;ve followed the above steps, it is time for you to test your WordPress site&#8217;s connectivity. If everything goes as planned, no further error messages should appear on your page and your website should display properly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following tutorial provides detailed information about the Error Establishing a Database Connection message in WordPress, including meaning and a few possible methods to fix it. &nbsp; What Does the Error Mean? If you are a website administrator and own a WordPress Hosting account, you have probably come across the Error Establishing a Database Connection [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":30497,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[86],"tags":[],"class_list":["post-25929","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-optimization"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Fix the Error Establishing a Database Connection in WordPress<\/title>\n<meta name=\"description\" content=\"This tutorial provides information about the Error Establishing a Database Connection error message in WordPress, and a few solutions to the problem.\" \/>\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.awardspace.com\/wordpress-tutorials\/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=\"How to Fix the Error Establishing a Database Connection in WordPress\" \/>\n<meta property=\"og:description\" content=\"This tutorial provides information about the Error Establishing a Database Connection error message in WordPress, and a few solutions to the problem.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/\" \/>\n<meta property=\"og:site_name\" content=\"AwardSpace.com\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/AwardSpace\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-11-12T07:41:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-28T07:24:00+00:00\" \/>\n<meta name=\"author\" content=\"ivailod\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@awspace\" \/>\n<meta name=\"twitter:site\" content=\"@awspace\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ivailod\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/\"},\"author\":{\"name\":\"ivailod\",\"@id\":\"https:\/\/www.awardspace.com\/#\/schema\/person\/ce135bfb9f8b0d51d047abe11d77b221\"},\"headline\":\"How to Fix the Error Establishing a Database Connection in WordPress\",\"datePublished\":\"2018-11-12T07:41:34+00:00\",\"dateModified\":\"2024-02-28T07:24:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/\"},\"wordCount\":446,\"publisher\":{\"@id\":\"https:\/\/www.awardspace.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#primaryimage\"},\"thumbnailUrl\":\"\",\"articleSection\":[\"Optimization\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/\",\"url\":\"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/\",\"name\":\"How to Fix the Error Establishing a Database Connection in WordPress\",\"isPartOf\":{\"@id\":\"https:\/\/www.awardspace.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#primaryimage\"},\"thumbnailUrl\":\"\",\"datePublished\":\"2018-11-12T07:41:34+00:00\",\"dateModified\":\"2024-02-28T07:24:00+00:00\",\"description\":\"This tutorial provides information about the Error Establishing a Database Connection error message in WordPress, and a few solutions to the problem.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#primaryimage\",\"url\":\"\",\"contentUrl\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.awardspace.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress Tutorials\",\"item\":\"https:\/\/www.awardspace.com\/wordpress-tutorials\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Optimization\",\"item\":\"https:\/\/www.awardspace.com\/wordpress-tutorials\/optimization\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"How to Fix the Error Establishing a Database Connection in WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.awardspace.com\/#website\",\"url\":\"https:\/\/www.awardspace.com\/\",\"name\":\"AwardSpace.com\",\"description\":\"Free Web Hosting with PHP, MySQL, Email Sending, No Ads\",\"publisher\":{\"@id\":\"https:\/\/www.awardspace.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.awardspace.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.awardspace.com\/#organization\",\"name\":\"AwardSpace.com\",\"url\":\"https:\/\/www.awardspace.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.awardspace.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.awardspace.com\/wp-content\/uploads\/2018\/08\/awardspace_logo.png\",\"contentUrl\":\"https:\/\/www.awardspace.com\/wp-content\/uploads\/2018\/08\/awardspace_logo.png\",\"width\":1759,\"height\":176,\"caption\":\"AwardSpace.com\"},\"image\":{\"@id\":\"https:\/\/www.awardspace.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/AwardSpace\/\",\"https:\/\/x.com\/awspace\",\"https:\/\/www.instagram.com\/awardspace\/\",\"https:\/\/www.quora.com\/profile\/Award-Space\",\"https:\/\/www.linkedin.com\/company\/19214384\/\",\"https:\/\/www.reddit.com\/user\/AwardSpace\",\"https:\/\/www.pinterest.com\/awardspace\/\",\"https:\/\/www.youtube.com\/user\/AwardspaceWebHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.awardspace.com\/#\/schema\/person\/ce135bfb9f8b0d51d047abe11d77b221\",\"name\":\"ivailod\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.awardspace.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"caption\":\"ivailod\"},\"url\":\"https:\/\/www.awardspace.com\/author\/ivailod\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Fix the Error Establishing a Database Connection in WordPress","description":"This tutorial provides information about the Error Establishing a Database Connection error message in WordPress, and a few solutions to the problem.","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.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/","og_locale":"en_US","og_type":"article","og_title":"How to Fix the Error Establishing a Database Connection in WordPress","og_description":"This tutorial provides information about the Error Establishing a Database Connection error message in WordPress, and a few solutions to the problem.","og_url":"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/","og_site_name":"AwardSpace.com","article_publisher":"https:\/\/www.facebook.com\/AwardSpace\/","article_published_time":"2018-11-12T07:41:34+00:00","article_modified_time":"2024-02-28T07:24:00+00:00","author":"ivailod","twitter_card":"summary_large_image","twitter_creator":"@awspace","twitter_site":"@awspace","twitter_misc":{"Written by":"ivailod","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#article","isPartOf":{"@id":"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/"},"author":{"name":"ivailod","@id":"https:\/\/www.awardspace.com\/#\/schema\/person\/ce135bfb9f8b0d51d047abe11d77b221"},"headline":"How to Fix the Error Establishing a Database Connection in WordPress","datePublished":"2018-11-12T07:41:34+00:00","dateModified":"2024-02-28T07:24:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/"},"wordCount":446,"publisher":{"@id":"https:\/\/www.awardspace.com\/#organization"},"image":{"@id":"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#primaryimage"},"thumbnailUrl":"","articleSection":["Optimization"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/","url":"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/","name":"How to Fix the Error Establishing a Database Connection in WordPress","isPartOf":{"@id":"https:\/\/www.awardspace.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#primaryimage"},"image":{"@id":"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#primaryimage"},"thumbnailUrl":"","datePublished":"2018-11-12T07:41:34+00:00","dateModified":"2024-02-28T07:24:00+00:00","description":"This tutorial provides information about the Error Establishing a Database Connection error message in WordPress, and a few solutions to the problem.","breadcrumb":{"@id":"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#primaryimage","url":"","contentUrl":""},{"@type":"BreadcrumbList","@id":"https:\/\/www.awardspace.com\/wordpress-tutorials\/error-establishing-database-connection\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.awardspace.com\/"},{"@type":"ListItem","position":2,"name":"WordPress Tutorials","item":"https:\/\/www.awardspace.com\/wordpress-tutorials\/"},{"@type":"ListItem","position":3,"name":"Optimization","item":"https:\/\/www.awardspace.com\/wordpress-tutorials\/optimization\/"},{"@type":"ListItem","position":4,"name":"How to Fix the Error Establishing a Database Connection in WordPress"}]},{"@type":"WebSite","@id":"https:\/\/www.awardspace.com\/#website","url":"https:\/\/www.awardspace.com\/","name":"AwardSpace.com","description":"Free Web Hosting with PHP, MySQL, Email Sending, No Ads","publisher":{"@id":"https:\/\/www.awardspace.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.awardspace.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.awardspace.com\/#organization","name":"AwardSpace.com","url":"https:\/\/www.awardspace.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.awardspace.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.awardspace.com\/wp-content\/uploads\/2018\/08\/awardspace_logo.png","contentUrl":"https:\/\/www.awardspace.com\/wp-content\/uploads\/2018\/08\/awardspace_logo.png","width":1759,"height":176,"caption":"AwardSpace.com"},"image":{"@id":"https:\/\/www.awardspace.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/AwardSpace\/","https:\/\/x.com\/awspace","https:\/\/www.instagram.com\/awardspace\/","https:\/\/www.quora.com\/profile\/Award-Space","https:\/\/www.linkedin.com\/company\/19214384\/","https:\/\/www.reddit.com\/user\/AwardSpace","https:\/\/www.pinterest.com\/awardspace\/","https:\/\/www.youtube.com\/user\/AwardspaceWebHosting"]},{"@type":"Person","@id":"https:\/\/www.awardspace.com\/#\/schema\/person\/ce135bfb9f8b0d51d047abe11d77b221","name":"ivailod","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.awardspace.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","caption":"ivailod"},"url":"https:\/\/www.awardspace.com\/author\/ivailod\/"}]}},"_links":{"self":[{"href":"https:\/\/www.awardspace.com\/wp-json\/wp\/v2\/posts\/25929","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.awardspace.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.awardspace.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.awardspace.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.awardspace.com\/wp-json\/wp\/v2\/comments?post=25929"}],"version-history":[{"count":0,"href":"https:\/\/www.awardspace.com\/wp-json\/wp\/v2\/posts\/25929\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.awardspace.com\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/www.awardspace.com\/wp-json\/wp\/v2\/media?parent=25929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.awardspace.com\/wp-json\/wp\/v2\/categories?post=25929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.awardspace.com\/wp-json\/wp\/v2\/tags?post=25929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}