{"id":577,"date":"2024-10-09T12:05:10","date_gmt":"2024-10-09T12:05:10","guid":{"rendered":"https:\/\/unlimitedhostingplan.in\/articles\/?p=577"},"modified":"2024-10-09T13:57:58","modified_gmt":"2024-10-09T13:57:58","slug":"cpanel-database-connection-issue","status":"publish","type":"post","link":"https:\/\/unlimitedhostingplan.in\/articles\/cpanel-database-connection-issue\/","title":{"rendered":"How to Troubleshoot cPanel Database Connection Issues"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">It is common for <a href=\"https:\/\/www.squarebrothers.com\/wordpress-hosting-india\/\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/www.squarebrothers.com\/wordpress-hosting-india\/\" rel=\"noreferrer noopener nofollow\">WordPress websites <\/a>to encounter database connection errors, which may seem overwhelming at first. This article provides an overview of this error and how to troubleshoot database connection.<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#i-am-getting-the-error-establishing-a-database-connection-page-what-is-it\">I am getting the &#8220;Error establishing a database connection&#8221; page. What is it?<\/a><\/li><li><a href=\"#check-your-websites-configuration-file-i-e-wp-config-php\">Check your website&#8217;s configuration file (i.e. wp-config.php)<\/a><\/li><li><a href=\"#there-has-been-a-critical-error-on-your-website\">There has been a critical error on your website<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-am-getting-the-error-establishing-a-database-connection-page-what-is-it\">I am getting the &#8220;Error establishing a database connection&#8221; page. What is it?<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"550\" height=\"182\" src=\"https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/error-establishing-database-connection.png\" alt=\"\" class=\"wp-image-578\" style=\"width:769px;height:auto\" srcset=\"https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/error-establishing-database-connection.png 550w, https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/error-establishing-database-connection-300x99.png 300w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A database is software that makes it easy to store, organize, and retrieve data into other software. As a content management system (CMS), WordPress uses a database to store all your content and other website data. It then connects to the database each time someone visits your website.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8220;Error establishing a database connection&#8221; is common among WordPress websites. It may be quite scary since it hardly displays any details. However, it is quite straightforward to understand. Every time a page is loaded on your WordPress site, it needs to access the database to retrieve the data required to display it. Simply put, if your website fails to connect to its database, it will not function properly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This issue can be caused by the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Incorrect database information in your WordPress settings<\/li>\n\n\n\n<li>Corrupt database<\/li>\n\n\n\n<li>Irresponsive database server<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"check-your-websites-configuration-file-i-e-wp-config-php\">Check your website&#8217;s configuration file (i.e. wp-config.php)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re using an application such as WordPress for your website, you should navigate to the directory where it is installed and open up the configuration file that connects it to the database (i.e. wp-config.php).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To do this, go to <strong>cPanel -&gt; File Manager<\/strong> and then the directory of WordPress, most often <strong>public_html<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240419854\/cf776598579369b547aacf94\/Screen+Shot+2020-08-27+at+2.50.41+PM.png?expires=1728476100&amp;signature=5147d384c5fbef8db5d1f3ec7d47d3730b89881ffb009728ffab8cb04e2c7ad7&amp;req=diQnEsh3lYRbFb4f3HP0gDueE4d6D5vVyCv%2Bym1WvcHdbxHi%2F1FTPr3mRowO%0ATN0MJfLPXFWelBLEXA%3D%3D%0A\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240419854\/cf776598579369b547aacf94\/Screen+Shot+2020-08-27+at+2.50.41+PM.png?expires=1728476100&amp;signature=5147d384c5fbef8db5d1f3ec7d47d3730b89881ffb009728ffab8cb04e2c7ad7&amp;req=diQnEsh3lYRbFb4f3HP0gDueE4d6D5vVyCv%2Bym1WvcHdbxHi%2F1FTPr3mRowO%0ATN0MJfLPXFWelBLEXA%3D%3D%0A\" alt=\"\" style=\"width:793px;height:auto\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you have trouble locating it, you can also use the search box in the top right to search all your folders for it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once located, <strong>right click and edit<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240420227\/4fb6805c6deacc90429077a9\/Screen+Shot+2020-08-27+at+2.51.57+PM.png?expires=1728476100&amp;signature=2373feef9677770083707c7d8b8d74ee34bfd4085b1bae6ecddabae4d1a0e38c&amp;req=diQnEst%2Bn4NYFb4f3HP0gDxtHwvuPLrJycqZLjq9cKD5kMYdoiMM06pFCJjc%0AWp5454h19iMjbHf%2Bgw%3D%3D%0A\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240420227\/4fb6805c6deacc90429077a9\/Screen+Shot+2020-08-27+at+2.51.57+PM.png?expires=1728476100&amp;signature=2373feef9677770083707c7d8b8d74ee34bfd4085b1bae6ecddabae4d1a0e38c&amp;req=diQnEst%2Bn4NYFb4f3HP0gDxtHwvuPLrJycqZLjq9cKD5kMYdoiMM06pFCJjc%0AWp5454h19iMjbHf%2Bgw%3D%3D%0A\" alt=\"\" style=\"width:554px;height:auto\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This will spawn another dialog, just <strong>click edit <\/strong>on it to open the file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You want to inspect the MySQL settings that include the <em>database name, user, and host <\/em>which should look something like this:<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240420844\/6f17a61bbc2213c63a7f97eb\/Screen+Shot+2020-08-27+at+2.53.52+PM.png?expires=1728476100&amp;signature=c2427b5f9bbef10b731147baccd599ea6c5781fd39ba70ec9e0747d9d8cb3f0e&amp;req=diQnEst%2BlYVbFb4f3HP0gAFWwXf6pi%2BlJcE7xe0mlUm1BcZ%2FtCaPc3ub5Sf0%0A8zG16Lv0d%2FnDXHUP3A%3D%3D%0A\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240420844\/6f17a61bbc2213c63a7f97eb\/Screen+Shot+2020-08-27+at+2.53.52+PM.png?expires=1728476100&amp;signature=c2427b5f9bbef10b731147baccd599ea6c5781fd39ba70ec9e0747d9d8cb3f0e&amp;req=diQnEst%2BlYVbFb4f3HP0gAFWwXf6pi%2BlJcE7xe0mlUm1BcZ%2FtCaPc3ub5Sf0%0A8zG16Lv0d%2FnDXHUP3A%3D%3D%0A\" alt=\"\" style=\"width:625px;height:auto\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">First, make sure the mySQL hostname says localhost as above.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If that&#8217;s correct, go back to <a href=\"https:\/\/www.unlimitedhostingplan.in\/web-hosting\/\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/www.unlimitedhostingplan.in\/web-hosting\/\" rel=\"noreferrer noopener nofollow\">cPanel <\/a>in another window and <strong>click on mySQL databases<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"924\" height=\"254\" src=\"https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/How-to-upload-and-configure-MySQL-database-into-cPanel1.png\" alt=\"\" class=\"wp-image-579\" srcset=\"https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/How-to-upload-and-configure-MySQL-database-into-cPanel1.png 924w, https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/How-to-upload-and-configure-MySQL-database-into-cPanel1-300x82.png 300w, https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/How-to-upload-and-configure-MySQL-database-into-cPanel1-768x211.png 768w\" sizes=\"auto, (max-width: 924px) 100vw, 924px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This will bring you to a dashboard with all of your databases.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You want to make sure the <em>database listed beside DB_NAME in your wp-config.php file exists<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In my above example my database is webloggy_wp59, so that&#8217;s what I&#8217;m looking for:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240421973\/c0ec63e74c65f1357e4b2dff\/Screen+Shot+2020-08-27+at+2.57.29+PM.png?expires=1728476100&amp;signature=53ad6ffc23dff8c1e05bd7579ab2650270471e94d2cbf131d9fa17a1071c1fb6&amp;req=diQnEst%2FlIZcFb4f3HP0gCb0vJvi1sBcf6WJgM4ddh9myqUnNsNs%2BpT6%2Bk6O%0Ak7S2jsDW0EAm9udR%2Fw%3D%3D%0A\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240421973\/c0ec63e74c65f1357e4b2dff\/Screen+Shot+2020-08-27+at+2.57.29+PM.png?expires=1728476100&amp;signature=53ad6ffc23dff8c1e05bd7579ab2650270471e94d2cbf131d9fa17a1071c1fb6&amp;req=diQnEst%2FlIZcFb4f3HP0gCb0vJvi1sBcf6WJgM4ddh9myqUnNsNs%2BpT6%2Bk6O%0Ak7S2jsDW0EAm9udR%2Fw%3D%3D%0A\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, the database does exist, <strong>so I confirm everything is spelled correctly<\/strong>, which it is.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the <em>database is spelled differently<\/em>, you would want to<strong> modify the section beside DB_NAME in your wp-config.php file<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since I&#8217;ve verified the hostname is localhost, the database is webloggy_wp59, and it&#8217;s spelled correctly in my config file, <strong>I want to inspect the DB_USER.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In my wp-config.php file, this is webloggy_wp59:<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240423229\/fd3121bc0158596b5140bc80\/Screen+Shot+2020-08-27+at+3.01.53+PM.png?expires=1728476100&amp;signature=a0787423427081a1e0ce41ebe6da8f975e748ca2de3f07f3e40db1a320ca2d0a&amp;req=diQnEst9n4NWFb4f3HP0gISHdrU8fCTztQAcwA2c1l0akyoDHy%2BOWzip13mi%0AJOFD51STXU7dZpdzTg%3D%3D%0A\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240423229\/fd3121bc0158596b5140bc80\/Screen+Shot+2020-08-27+at+3.01.53+PM.png?expires=1728476100&amp;signature=a0787423427081a1e0ce41ebe6da8f975e748ca2de3f07f3e40db1a320ca2d0a&amp;req=diQnEst9n4NWFb4f3HP0gISHdrU8fCTztQAcwA2c1l0akyoDHy%2BOWzip13mi%0AJOFD51STXU7dZpdzTg%3D%3D%0A\" alt=\"\" style=\"width:511px;height:auto\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Next, I want to compare this to the <strong>Privileged Users column next to my database in cPanel<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240423607\/40b6414f0a31170069125b0f\/Screen+Shot+2020-08-27+at+3.02.52+PM.png?expires=1728476100&amp;signature=7f8a0ed282f1e0c9abdedb99f2f7230ed8d64ff61c31169701bc7c370a8593ce&amp;req=diQnEst9m4FYFb4f3HP0gKVse%2BHVUIJ%2B7%2BWnU0810zqI03TvOYmutlo5jVGR%0AfqlKDn%2Bwz2I9vOB5kg%3D%3D%0A\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240423607\/40b6414f0a31170069125b0f\/Screen+Shot+2020-08-27+at+3.02.52+PM.png?expires=1728476100&amp;signature=7f8a0ed282f1e0c9abdedb99f2f7230ed8d64ff61c31169701bc7c370a8593ce&amp;req=diQnEst9m4FYFb4f3HP0gKVse%2BHVUIJ%2B7%2BWnU0810zqI03TvOYmutlo5jVGR%0AfqlKDn%2Bwz2I9vOB5kg%3D%3D%0A\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Bingo! I found the problem; the database user in <strong>my wp-config.php file doesn&#8217;t match the one inside of cPanel<\/strong>!<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Now if there wasn&#8217;t a user in the Privileged User&#8217;s column, I would want to scroll down the page where I could create a new one, and then add it to the database.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Therefore, I want to go back into my wp-config.php file and <strong>input the correct DB_USER like this<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240424131\/42a77ec5c35c4205a7f91d8e\/Screen+Shot+2020-08-27+at+3.04.45+PM.png?expires=1728476100&amp;signature=aafaae701efe5d4bd6467838f7552dc0e39eb8f485da2b4740b90ff500351200&amp;req=diQnEst6nIJeFb4f3HP0gFiA4HbtXZkWlgK5CdFMjUqRWRVsm7xtrm5F8uOE%0AI7XSTytx%2F88Gh%2BaFKQ%3D%3D%0A\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240424131\/42a77ec5c35c4205a7f91d8e\/Screen+Shot+2020-08-27+at+3.04.45+PM.png?expires=1728476100&amp;signature=aafaae701efe5d4bd6467838f7552dc0e39eb8f485da2b4740b90ff500351200&amp;req=diQnEst6nIJeFb4f3HP0gFiA4HbtXZkWlgK5CdFMjUqRWRVsm7xtrm5F8uOE%0AI7XSTytx%2F88Gh%2BaFKQ%3D%3D%0A\" alt=\"\" style=\"width:491px;height:auto\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Notice I entered this in between the quotation marks; I don&#8217;t want to remove those.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since the database user was incorrect, I have to assume it&#8217;s also using the incorrect database password. Therefore I need to return to the mySQL dashboard in cPanel and reset it. If I scroll down the page from where my databases are listed, I&#8217;ll see <strong>Current Users<\/strong>. Next to the correct user, I will <strong>click Change Password<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240424703\/faf54bcd7f5d62646a534f49\/Screen+Shot+2020-08-27+at+3.07.05+PM.png?expires=1728476100&amp;signature=e6351c310c5afc28b904e5df2cd792ec7773addc3a9b0994c43ff761cb4f6f32&amp;req=diQnEst6moFcFb4f3HP0gGlrKIRj6rGSsdSouirGrlYwhr%2BJbzOAFXAunP0X%0AqYmsYWaCtf2%2FoII%2FLg%3D%3D%0A\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240424703\/faf54bcd7f5d62646a534f49\/Screen+Shot+2020-08-27+at+3.07.05+PM.png?expires=1728476100&amp;signature=e6351c310c5afc28b904e5df2cd792ec7773addc3a9b0994c43ff761cb4f6f32&amp;req=diQnEst6moFcFb4f3HP0gGlrKIRj6rGSsdSouirGrlYwhr%2BJbzOAFXAunP0X%0AqYmsYWaCtf2%2FoII%2FLg%3D%3D%0A\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This will bring me to a page where I can add the correct password. While I could simply input the password from my wp-config.php file beside DB_PASSWORD, it&#8217;s best security password just to reset it. Therefore <strong>I&#8217;ll use the Password Generate to create me a strong one<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"684\" src=\"https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/image-1024x684.png\" alt=\"\" class=\"wp-image-580\" style=\"width:732px;height:auto\" srcset=\"https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/image-1024x684.png 1024w, https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/image-300x200.png 300w, https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/image-768x513.png 768w, https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/image.png 1066w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As noted by the red arrows, I need to first generate it and before confirming I&#8217;ve copied it down, <strong>I need to go back to my wp-config.php file and enter it there<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240425905\/a49bbad4f5d0412dc91ddde6\/Screen+Shot+2020-08-27+at+3.11.53+PM.png?expires=1728476100&amp;signature=49a59c95833f5ce76bc790db60d6dbd5185a0e6a9bb7639ee650c407f45913ed&amp;req=diQnEst7lIFaFb4f3HP0gOCR0edUJV2TWcrxyCvQFR5yIM8%2BV5J%2BB5p1zzzi%0AtMf4O%2BDNI2Nn0WwfoQ%3D%3D%0A\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240425905\/a49bbad4f5d0412dc91ddde6\/Screen+Shot+2020-08-27+at+3.11.53+PM.png?expires=1728476100&amp;signature=49a59c95833f5ce76bc790db60d6dbd5185a0e6a9bb7639ee650c407f45913ed&amp;req=diQnEst7lIFaFb4f3HP0gOCR0edUJV2TWcrxyCvQFR5yIM8%2BV5J%2BB5p1zzzi%0AtMf4O%2BDNI2Nn0WwfoQ%3D%3D%0A\" alt=\"\" style=\"width:532px;height:auto\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Just like the database name and user, I input the password in between the quotes. Removing those would create another error.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once I&#8217;ve down this, I can go back to cPanel and <strong>click Use Password<\/strong>. This will bring me back to the password reset screen where I can officially change the password, but I want to be sure the strength is Very Strong (100\/100):<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"535\" height=\"462\" src=\"https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/image-1.png\" alt=\"\" class=\"wp-image-581\" style=\"width:501px;height:auto\" srcset=\"https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/image-1.png 535w, https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/image-1-300x259.png 300w\" sizes=\"auto, (max-width: 535px) 100vw, 535px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now, I can go back to my wp-config.php file and <strong>click Save Changes<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"995\" height=\"518\" src=\"https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/Screen-Shot-2020-08-27-at-3.15.23-PM.png\" alt=\"\" class=\"wp-image-582\" style=\"width:764px;height:auto\" srcset=\"https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/Screen-Shot-2020-08-27-at-3.15.23-PM.png 995w, https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/Screen-Shot-2020-08-27-at-3.15.23-PM-300x156.png 300w, https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/Screen-Shot-2020-08-27-at-3.15.23-PM-768x400.png 768w\" sizes=\"auto, (max-width: 995px) 100vw, 995px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I then refresh my website and see the dreaded error is gone and my website is back online<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"check-my-sql-php-extensions\"><strong>Check mySQL PHP Extensions<\/strong><\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">This is one setting that is often overlooked in troubleshooting, but can save you a lot of time and frustration. Most often, the error for this looks a bit different than above, but here is what one looks like in WordPress:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"there-has-been-a-critical-error-on-your-website\">There has been a critical error on your website<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240438682\/f0c09128a76bcea74b5d3a65\/Screen+Shot+2020-08-27+at+3.54.11+PM.png?expires=1728476100&amp;signature=856c4d49c93b7dfdd9c63d40f5c8f162fadbd330a41879e051a4910fdb7e7062&amp;req=diQnEsp2m4ldFb4f3HP0gNiSK99lO735K8CuhELG9JaaYzVf8iHg0vY4WBt2%0AnRNofwt%2FYtQhUdLIuA%3D%3D%0A\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240438682\/f0c09128a76bcea74b5d3a65\/Screen+Shot+2020-08-27+at+3.54.11+PM.png?expires=1728476100&amp;signature=856c4d49c93b7dfdd9c63d40f5c8f162fadbd330a41879e051a4910fdb7e7062&amp;req=diQnEsp2m4ldFb4f3HP0gNiSK99lO735K8CuhELG9JaaYzVf8iHg0vY4WBt2%0AnRNofwt%2FYtQhUdLIuA%3D%3D%0A\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;ve recently changed PHP versions, made any PHP modifications, or moved from another web host, you should go into <strong>cPanel -&gt; Select PHP Version<\/strong> and<strong> inspect the PHP Extensions that include mySQL<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"862\" src=\"https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/image-2-1024x862.png\" alt=\"\" class=\"wp-image-585\" style=\"width:691px;height:auto\" srcset=\"https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/image-2-1024x862.png 1024w, https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/image-2-300x253.png 300w, https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/image-2-768x647.png 768w, https:\/\/unlimitedhostingplan.in\/articles\/wp-content\/uploads\/2024\/10\/image-2.png 1071w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The above screenshot points to <strong>mysqli, mysqlnd, and pdo_mysql, which are enabled<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>If you look closely below the second arrow, you&#8217;ll notice nd_mysqli and nd_pdo_mysql are unchecked.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Without going all technical, depending on your application\/theme\/plugin(s) used, along with PHP version, you may need to change these up a bit. mySQL is dependent upon these in order to connect properly to PHP.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>To quickly solve the error, you may wish to change your PHP version which will use the defaults we&#8217;ve provided.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the above screenshot, we&#8217;re using 7.2 which is a bit outdated, so we can try 7.3 with our default settings. <em>We then want to make sure mysqlnd and nd_mysqli are checked:<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240437022\/b5d4529c4054976de3cf0f33\/Screen+Shot+2020-08-27+at+3.48.54+PM.png?expires=1728476100&amp;signature=b9550f0b8c4127901924601d3100355dc08b3f06c026dd615ddfb2fe2830edae&amp;req=diQnEsp5nYNdFb4f3HP0gFJ9NpI9oN01sHlfWG8vxM7ySt3JDTGIlMouJY%2Bh%0Az31I69QNmSSBAxJ7XQ%3D%3D%0A\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/downloads.intercomcdn.com\/i\/o\/240437022\/b5d4529c4054976de3cf0f33\/Screen+Shot+2020-08-27+at+3.48.54+PM.png?expires=1728476100&amp;signature=b9550f0b8c4127901924601d3100355dc08b3f06c026dd615ddfb2fe2830edae&amp;req=diQnEsp5nYNdFb4f3HP0gFJ9NpI9oN01sHlfWG8vxM7ySt3JDTGIlMouJY%2Bh%0Az31I69QNmSSBAxJ7XQ%3D%3D%0A\" alt=\"\" style=\"width:322px;height:auto\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><em>If you uncheck nd_mysqli you will see an error.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Likewise, if you&#8217;re using PHP 7.3, you may want to change over to 7.2 and then check that your application\/plugins\/themes are all running their latest version and see if what PHP specific extensions they require.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Most often, database connection errors stem from incorrect credentials inside of your PHP configuration file (i.e. wp-config.php). Ensuring these are entered correctly as well as the appropriate permissions are set, will resolve this quickly. These are more common for those who have recently moved from another web host, restored a backup, or accidentally removed\/modified the wp-config.php file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Having incorrect PHP mySQL extensions enabled\/disabled usually occur when you&#8217;ve changed to a new version of PHP or are using an outdated theme\/plugin.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is common for WordPress websites to encounter database connection errors, which may seem overwhelming at first. This article provides an overview of this error and how to troubleshoot database connection. I am getting the &#8220;Error establishing a database connection&#8221; page. What is it? A database is software that makes it easy to store, organize, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-577","post","type-post","status-publish","format-standard","hentry","category-security"],"_links":{"self":[{"href":"https:\/\/unlimitedhostingplan.in\/articles\/wp-json\/wp\/v2\/posts\/577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unlimitedhostingplan.in\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unlimitedhostingplan.in\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unlimitedhostingplan.in\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unlimitedhostingplan.in\/articles\/wp-json\/wp\/v2\/comments?post=577"}],"version-history":[{"count":9,"href":"https:\/\/unlimitedhostingplan.in\/articles\/wp-json\/wp\/v2\/posts\/577\/revisions"}],"predecessor-version":[{"id":594,"href":"https:\/\/unlimitedhostingplan.in\/articles\/wp-json\/wp\/v2\/posts\/577\/revisions\/594"}],"wp:attachment":[{"href":"https:\/\/unlimitedhostingplan.in\/articles\/wp-json\/wp\/v2\/media?parent=577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unlimitedhostingplan.in\/articles\/wp-json\/wp\/v2\/categories?post=577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unlimitedhostingplan.in\/articles\/wp-json\/wp\/v2\/tags?post=577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}