{"id":559,"date":"2021-12-21T08:38:06","date_gmt":"2021-12-21T07:38:06","guid":{"rendered":"https:\/\/mic.st\/blog\/?p=559"},"modified":"2025-05-21T13:24:30","modified_gmt":"2025-05-21T11:24:30","slug":"how-to-fix-error-establishing-a-database-connection-for-wordpress","status":"publish","type":"post","link":"https:\/\/mic.st\/blog\/how-to-fix-error-establishing-a-database-connection-for-wordpress\/","title":{"rendered":"How to fix &#8220;Error establishing a database connection&#8221;"},"content":{"rendered":"\n<p><strong>TLDR<\/strong>: Try doing a &#8220;Powercycle&#8221;, i.e. shutdown and restart your server. I had a button for that in my server&#8217;s control panel.<\/p>\n\n\n\n<p><strong>Update<\/strong>: My blog was broken once again, with that error. This time some more was involved. See my second article: <a href=\"https:\/\/mic.st\/blog\/error-establishing-a-database-connection-and-how-to-fix-this\/\">https:\/\/mic.st\/blog\/error-establishing-a-database-connection-and-how-to-fix-this\/<\/a><\/p>\n\n\n\n<p>Yesterday night, I updated some WordPress plugins. Everything seemed to have went well, so I closed my laptop and went to sleep.<\/p>\n\n\n\n<p>This morning, I was welcomed with a message showing &#8220;Error establishing a database connection&#8221;. On the <code>wp-admin<\/code> path there was some more explanation but all of this did not help. Obviously, I did not change any SQL login credentials so having a look at <code>wp-config.php<\/code> to check these as recommended seemed useless (and it was).<\/p>\n\n\n\n<p>I tried to login to my SQL database via command line which also did not work. I just got some socket error. Googling this, lead to more stuff that did not work. I tried to stop and restart my MySQL server which also did not work. Luckily, I did not try everything recommended there, as some would have easily destroyed everything (I guess).<\/p>\n\n\n\n<p>So, long story short: The easy solution was to login to my server&#8217;s control panel and push that &#8220;Powercycle&#8221; button:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"480\" height=\"146\" src=\"https:\/\/mic.st\/blog\/wp-content\/uploads\/2021\/12\/image.png\" alt=\"\" class=\"wp-image-560\" srcset=\"https:\/\/mic.st\/blog\/wp-content\/uploads\/2021\/12\/image.png 480w, https:\/\/mic.st\/blog\/wp-content\/uploads\/2021\/12\/image-300x91.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><figcaption class=\"wp-element-caption\">Section in Netcup&#8217;s &#8220;Customer Control Panel&#8221; to do a powercycle.<\/figcaption><\/figure>\n\n\n\n<p>Sometimes it&#8217;s way easier than expected. <\/p>\n\n\n\n<p>Just pull the plug.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TLDR: Try doing a &#8220;Powercycle&#8221;, i.e. shutdown and restart your server. I had a button for that in my server&#8217;s control panel. Update: My blog was broken once again, with that error. This time some more was involved. See my second article: https:\/\/mic.st\/blog\/error-establishing-a-database-connection-and-how-to-fix-this\/ Yesterday night, I updated some WordPress plugins. Everything seemed to have went&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[2],"tags":[38],"class_list":["post-559","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/posts\/559","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/comments?post=559"}],"version-history":[{"count":6,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/posts\/559\/revisions"}],"predecessor-version":[{"id":996,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/posts\/559\/revisions\/996"}],"wp:attachment":[{"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/media?parent=559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/categories?post=559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/tags?post=559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}