{"id":1074,"date":"2025-12-28T15:29:24","date_gmt":"2025-12-28T14:29:24","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=1074"},"modified":"2026-06-08T13:07:26","modified_gmt":"2026-06-08T11:07:26","slug":"what-to-do-when-wordpress-shows-a-database-connection-error","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/en\/knowledgebase\/what-to-do-when-wordpress-shows-a-database-connection-error\/","title":{"rendered":"What to do when WordPress shows a database connection error?"},"content":{"rendered":"\n<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">In a situation where <strong><em>&#8220;WordPress&#8221;<\/em><\/strong> does not have the ability to properly communicate with the database, instead of your website, you may receive a message like the screenshot below.<\/p>\n\n\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"334\" height=\"74\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-382.png\" alt=\"\" class=\"wp-image-5587\" srcset=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-382.png 334w, https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-382-300x66.png 300w, https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-382-18x4.png 18w\" sizes=\"auto, (max-width: 334px) 100vw, 334px\" \/><\/figure>\n<\/div>\n\n<div class=\"translation-block translation-block-merged\">\n\n\n<p class=\"wp-block-paragraph\">The most common reason is to change the password to the database from the mybox panel, after which the new password has not been updated in the <em><strong>&#8220;WordPress&#8221;<\/strong><\/em> configuration file, or the WordPress configuration file &#8211; <strong>wp-config.php<\/strong> located in the main directory of the website has been modified. When any of the fields responsible for communication with the database has been edited, it may result in an error.<\/p>\n\n\n\n<\/div>\n\n<div id=\"mybox-705357525\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Early access<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Still need help?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contact our customer service team.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Message us<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">The <strong>wp-config.php<\/strong> file is located in the root directory of the domain. By default, when you connect to an FTP server, it will be the path: <strong>\/yourdomain.com\/public_html<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The parameters responsible for communication with the database are:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>define('DB_NAME', 'database_name'); \/\/ MySQL database name\ndefine('DB_USER', 'user'); \/\/ MySQL database username\ndefine('DB_PASSWORD', 'password'); \/\/ MySQL database password<\/code><\/pre>\n\n\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"497\" height=\"413\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-327.png\" alt=\"\" class=\"wp-image-4709\" srcset=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-327.png 497w, https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-327-300x249.png 300w, https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-327-14x12.png 14w\" sizes=\"auto, (max-width: 497px) 100vw, 497px\" \/><\/figure>\n<\/div>\n\n<div class=\"translation-block translation-block-merged\">\n\n\n<p class=\"wp-block-paragraph\">This data is randomly generated when you perform an automatic installation from the mybox panel, while when the installation is done manually, you define it yourself when creating the database.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Changing the password for a database user<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If there is such a need and you do not know what password is currently set, and the one present in the <strong>file wp-config.php<\/strong> does not work properly, you can set a new one through the mybox panel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once you&#8217;re logged in, go to the <em><strong>&#8220;Databases&#8221;<\/strong><\/em> section and there <em><strong>&#8220;MySQL Users&#8221;.<\/strong><\/em><\/p>\n\n\n\n<\/div>\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"274\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-328-1024x274.png\" alt=\"\" class=\"wp-image-4711\" srcset=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-328-1024x274.png 1024w, https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-328-300x80.png 300w, https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-328-768x205.png 768w, https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-328-18x5.png 18w, https:\/\/mybox.com\/help\/wp-content\/uploads\/2025\/12\/image-328.png 1305w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n<div class=\"translation-block translation-block-merged\">\n\n\n\n<p class=\"wp-block-paragraph\">On the page that opens, based on the contents of the <strong>wp-config.php<\/strong> file, find the user and click the <em><strong>&#8220;Change Password&#8221;<\/strong><\/em> button on the right. In the window that appears, you will be able to use the generator or enter any password of your choice and thus modify it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once you have ordered a change in the mybox panel, the last step will be to go back to the <strong>wp-config.php<\/strong> file and enter the newly established password there.<\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[9,25,58],"manual_kb_tag":[190,471,636,637,638,639,640,641,642,643],"class_list":["post-1074","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-databases","manualknowledgebasecat-hosting","manualknowledgebasecat-web-applications-cms","manual_kb_tag-wordpress","manual_kb_tag-root-directory","manual_kb_tag-database-connection-error","manual_kb_tag-database-credentials","manual_kb_tag-wp-config-file","manual_kb_tag-change-database-password","manual_kb_tag-database-password","manual_kb_tag-database-username","manual_kb_tag-database-user-management","manual_kb_tag-public-html-directory"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/1074","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":3,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/1074\/revisions"}],"predecessor-version":[{"id":4712,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/1074\/revisions\/4712"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/media?parent=1074"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manualknowledgebasecat?post=1074"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb_tag?post=1074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}