{"id":20685,"date":"2020-11-30T05:00:52","date_gmt":"2020-11-29T21:00:52","guid":{"rendered":"https:\/\/web.mwwsb.com.my\/pjci\/?post_type=kb&p=20685"},"modified":"2022-09-08T21:25:08","modified_gmt":"2022-09-08T13:25:08","slug":"how-to-fix-the-error-establishing-a-database-connection-in-wordpress","status":"publish","type":"kb","link":"https:\/\/www.casbay.com\/guide\/kb\/how-to-fix-the-error-establishing-a-database-connection-in-wordpress","title":{"rendered":"HOW TO:Fix the \u201cError Establishing a Database Connection\u201d in WordPress"},"content":{"rendered":"\t\t
As a dynamic content management system, WordPress relies on a MySQL database that stores your content, website settings, and more. If WordPress is unable to communicate with its database, you\u2019ll see an error message stating: Error establishing a database connection<\/strong>.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t If your WordPress website was previously working normally, clearly something has changed to break the link between WordPress and the database. Possible causes could be:<\/p> If this is the first time you\u2019ve tried to use WordPress, the most likely cause is that your database credentials are incorrect or have changed. Use the following steps to troubleshoot the issue.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t When installing WordPress, you will have been asked to input a\u00a0database hostname<\/strong>,\u00a0database name<\/strong>,\u00a0database username<\/strong>\u00a0and\u00a0password<\/strong>. These credentials are stored in your\u00a0wp-config.php<\/strong>\u00a0file. A great first step for troubleshooting database connection errors is to check that the database credentials in your wp-config.php file are correct.<\/p> You can use an\u00a0FTP client<\/strong>\u00a0to access the file on your hosting, or alternatively, use\u00a0cPanel File Manager<\/strong>.<\/p> Firstly, log in to your\u00a0cPanel<\/strong>.<\/p> Secondly, select\u00a0File Manager<\/strong>.<\/p> Then, Navigate to your WordPress folder and look for your\u00a0wp-config.php<\/strong>\u00a0file. Right click on the file and select\u00a0Edit<\/strong>.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t You\u2019ll see your database credentials listed under\u00a0MySQL settings<\/strong>. Check that the\u00a0database hostname<\/strong>,\u00a0database name<\/strong>,\u00a0database username, <\/strong>and\u00a0password<\/strong>\u00a0are correct. You can find your database credentials at\u00a0My cPanel > MySQL Databases<\/strong>.<\/p> Make any necessary changes in your wp-config.php file and then click\u00a0Save Changes<\/strong>\u00a0to proceed. Try to access WordPress once again to see if your issue remains.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":" Fix the \u201cError Establishing a Database Connection\u201d in WordPress As a dynamic content management system, WordPress relies on a MySQL database that stores your content, website settings and more. If WordPress is unable to communicate with its database, you\u2019ll see an error message stating:\u00a0Error establishing a database connection. Error establishing a database connection message If […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}}},"kbtopic":[43],"kbtag":[106],"mkb_version":[],"_links":{"self":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/20685"}],"collection":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/comments?post=20685"}],"version-history":[{"count":13,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/20685\/revisions"}],"predecessor-version":[{"id":36069,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/20685\/revisions\/36069"}],"wp:attachment":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/media?parent=20685"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=20685"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtag?post=20685"},{"taxonomy":"mkb_version","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/mkb_version?post=20685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\tCheck your WordPress configuration<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t