{"id":583,"date":"2016-06-01T00:00:00","date_gmt":"2016-06-01T00:00:00","guid":{"rendered":"http:\/\/blog.hostinger.io\/hostinger-tutorials\/uncategorized\/wordpresswordpress-error-establishing-database-connection\/"},"modified":"2026-03-10T09:31:32","modified_gmt":"2026-03-10T09:31:32","slug":"how-to-fix-error-establishing-a-database-connection-in-wordpress","status":"publish","type":"post","link":"\/ca\/tutorials\/how-to-fix-error-establishing-a-database-connection-in-wordpress","title":{"rendered":"How to fix &#8220;Error establishing a database connection&#8221; in WordPress"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>&ldquo;Error establishing a database connection&rdquo; in WordPress means <strong>your website cannot communicate with its MySQL database<\/strong>, preventing the site from loading and showing an error message instead.<\/p><p>This problem usually comes from incorrect database credentials in the configuration file, a corrupted database, or an unresponsive server. To fix it, check your credentials, repair the database, and make sure your server is running correctly.<\/p><ol class=\"wp-block-list\">\n<li>Check your database credentials.<\/li>\n\n\n\n<li>Verify the database server status.<\/li>\n\n\n\n<li>Repair the WordPress database.<\/li>\n\n\n\n<li>Replace corrupted core files.<\/li>\n\n\n\n<li>Create a new database and restore it from a backup.<\/li>\n\n\n\n<li>Update the WordPress website URL.<\/li>\n\n\n\n<li>Confirm that your domain points to the correct host.<\/li>\n\n\n\n<li>Contact your hosting provider or reboot the server.<\/li>\n<\/ol><p>If you prefer a visual guide to solve &ldquo;Error establishing a database connection,&rdquo; check out this video from Hostinger Academy. It covers how to match your database login credentials, verify where your domain is pointing, and fix corrupted files.<\/p><figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"How to Fix Error Establishing a Database Connection\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/WsdND0nun6s?start=1&amp;feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure><p>\n  <div class=\"youtube-shortcode\">\n    <div class=\"row\">\n      <div class=\"col-7 col-sm-8 d-flex align-items-center\">\n        <img decoding=\"async\" class=\"channel-logo\" src=\"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-content\/themes\/tutorialsthemeuplift\/public\/images\/youtube-channels\/hostinger-academy.jpg\" alt=\"youtube channel logo\">\n        <div class=\"d-flex flex-column justify-content-between\">\n          <span class=\"slogan d-none d-sm-block\">Subscribe For more educational videos!<\/span>\n          <span class=\"channel-name\">Hostinger Academy<\/span>\n                    <\/div>\n      <\/div>\n      <div class=\"col-5 col-sm-4 d-flex align-items-center justify-content-end\">\n          <a class=\"subscribe-button\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" href=\"http:\/\/www.youtube.com\/channel\/UCbNIC-svDbtUOH2qsLnPQPg?sub_confirmation=1\">\n            <img decoding=\"async\" src=\"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-content\/themes\/tutorialsthemeuplift\/public\/images\/icons\/youtube.svg\" alt=\"subscribe\">\n            <span>Subscribe<\/span>\n          <\/a>\n      <\/div>\n    <\/div>\n  <\/div>\n\n    \n\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-what-is-error-establishing-a-database-connection\">What is &ldquo;Error establishing a database connection&rdquo;?<\/h2><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1c3ccb4d3f\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"407\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/error-establishing-database-connection-with-potential-causes-1024x407.png\" alt=\"Screenshot of a WordPress &ldquo;Error establishing a database connection&rdquo; message with a list of potential causes displayed below.\" class=\"wp-image-104811\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>&ldquo;Error establishing a database connection&rdquo; is a common WordPress issue that occurs <strong>when your website&rsquo;s files (PHP) fail to communicate with its MySQL database.<\/strong><\/p><p>Your WordPress site runs on the <a href=\"\/ca\/tutorials\/what-is-php\">PHP programming language<\/a>, while all of its content and settings live in a <a href=\"\/ca\/tutorials\/what-is-mysql\">MySQL database<\/a>.<\/p><p>When a visitor opens your website, PHP code runs a request to fetch the necessary information from the database. The database then returns the data, and WordPress assembles it into a complete web page.<\/p><p>If the PHP code cannot connect to the database, the process stops, and the error message appears.<\/p><p>Sometimes, you may not see this error immediately on the front end if your site serves a cached version of a page.<\/p><p>A clear sign of the problem is when you can&rsquo;t access your WordPress admin dashboard, since the backend almost always requires a live database connection.<\/p><h2 class=\"wp-block-heading\" id=\"h-what-causes-error-establishing-a-database-connection-in-wordpress\">What causes &ldquo;Error establishing a database connection&rdquo; in WordPress?<\/h2><p>Several issues &ndash; such as <strong>incorrect database credentials, a corrupted database, or an overloaded server<\/strong> &ndash; can disrupt the connection between WordPress and its database.<\/p><ul class=\"wp-block-list\">\n<li><strong>Incorrect database credentials<\/strong> is the most common cause. The <strong>wp-config.php<\/strong> file stores the database name, username, password, and host. If any of these details are wrong, WordPress cannot log in to the database.<\/li>\n\n\n\n<li><strong>A corrupted database<\/strong> can also block the connection. <a href=\"\/ca\/tutorials\/wordpress-database\">WordPress database<\/a> tables may become corrupted after a faulty plugin or theme update, or because of an unexpected server shutdown.<\/li>\n\n\n\n<li><strong>An overloaded or unresponsive MySQL server<\/strong> may fail to handle connection requests. This usually happens when your hosting server experiences a traffic spike that exceeds its resources or when the database server itself goes down.<\/li>\n\n\n\n<li><strong>Corrupted WordPress core files<\/strong> can disrupt your site&rsquo;s operation. If essential files are damaged or modified incorrectly, WordPress may fail to initiate a database connection.<\/li>\n\n\n\n<li><strong>A misconfigured website URL<\/strong> after a site migration often breaks the database link. If you move your site to a new host or domain, outdated URL values in the database can cause redirect loops or connection failures.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-how-to-fix-the-wordpress-error-establishing-a-database-connection\">How to fix the WordPress &ldquo;Error establishing a database connection&rdquo;<\/h2><p>To fix &ldquo;Error establishing a database connection&rdquo; in WordPress, start by <strong>verifying your database credentials in the wp-config.php file and checking if the database is online and accessible.<\/strong><\/p><p>If the problem persists, repair the WordPress database or replace any corrupted core files. If that doesn&rsquo;t work, create a new database, update your site&rsquo;s URL, and confirm that your domain points to the correct host.<\/p><p>If none of these steps solve the issue, reboot your server yourself or contact your hosting provider for assistance.<\/p><p>Before trying any of these solutions, we strongly recommend <a href=\"\/ca\/tutorials\/backup-wordpress\">creating a backup of your WordPress site<\/a>. This way, you can restore your site if something goes wrong during troubleshooting.<\/p><h3 class=\"wp-block-heading\" id=\"h-1-check-your-database-credentials\">1. Check your database credentials<\/h3><p>The most common cause of a database connection error is incorrect credentials in your <a href=\"\/ca\/tutorials\/how-to-use-wp-config-php-wordpress-function\">wp-config.php<\/a> file. This often happens after migrating your site to a new host.<\/p><p>First, locate your correct database credentials in your hosting control panel. Then, compare them with the values in your <strong>wp-config.php<\/strong> file.<\/p><p>For <a href=\"\/ca\/wordpress-hosting\">Hostinger&rsquo;s managed WordPress<\/a> customers, here&rsquo;s how to do it in hPanel:<\/p><ol class=\"wp-block-list\">\n<li>Log in to hPanel using your Hostinger account, then navigate to <strong>Websites &rarr; Website list &rarr; Dashboard<\/strong>.<\/li>\n\n\n\n<li>From the dashboard&rsquo;s left sidebar, go to <strong>Databases &rarr; Management<\/strong>.<\/li>\n\n\n\n<li>Under the <strong>List of Current MySQL Databases and Users<\/strong> section, note your MySQL database name and user.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1c3ccb6492\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"386\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/hpanel-management-list-of-current-mysql-databases-and-users-1024x386.png\" alt=\"Screenshot of Hostinger hPanel showing the management page with the list of current MySQL databases and users.\" class=\"wp-image-134835\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>If you don&rsquo;t know the password, create a new one by clicking the <strong>three-dot icon<\/strong> next to the user and selecting <strong>Change Password<\/strong>.<\/li>\n\n\n\n<li>Next, navigate to <strong>Files &rarr; File Manager<\/strong> and open your site&rsquo;s root directory, typically <strong>public_html<\/strong>.<\/li>\n\n\n\n<li>Right-click on the <strong>wp-config.php<\/strong> file and select <strong>Edit<\/strong>.<\/li>\n\n\n\n<li>Compare the following values with the ones in your database management panel:\n<ul class=\"wp-block-list\">\n<li><strong>DB_NAME<\/strong> &ndash; your MySQL database name.<\/li>\n\n\n\n<li><strong>DB_USER<\/strong> &ndash; your MySQL database username.<\/li>\n\n\n\n<li><strong>DB_PASSWORD<\/strong> &ndash; your MySQL database password.<\/li>\n\n\n\n<li><strong>DB_HOST<\/strong> &ndash; your MySQL database host (usually localhost or <strong>127.0.0.1<\/strong>, but confirm with your provider).<\/li>\n<\/ul>\n<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1c3ccb77fd\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"434\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/hpanel-file-manager-wp-config-php-database-settings-highlighted-1024x434.png\" alt=\"Screenshot of Hostinger hPanel File Manager with the wp-config.php database settings highlighted.\" class=\"wp-image-134836\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"8\" class=\"wp-block-list\">\n<li>If any values are incorrect, update them directly in the file and click the <strong>Save<\/strong> icon. Then refresh your website to check if the error is fixed.<\/li>\n<\/ol><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-wordpress-hosting\" href=\"\/ca\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner-1024x300.png\" alt=\"\" class=\"wp-image-111781\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-2-check-the-database-server-status\">2. Check the database server status<\/h3><p>If your credentials are correct, the problem stems from the MySQL database server itself. The server could be down or unable to process requests because of a traffic surge.<\/p><p>To confirm this, contact your hosting provider&rsquo;s support team. Ask if other users on the same server are having issues or if the MySQL server is offline.<\/p><p>If you host another site on the same server, run a quick test to see if those sites are working. If they&rsquo;re also down, it&rsquo;s a strong sign that the issue is on your hosting provider&rsquo;s side.<\/p><p>At Hostinger, you can check the <a href=\"https:\/\/statuspage.hostinger.com\" target=\"_blank\" rel=\"noopener\">status page<\/a> for any ongoing server maintenance or reported issues.<\/p><h3 class=\"wp-block-heading\" id=\"h-3-repair-the-wordpress-database\">3. Repair the WordPress database<\/h3><p>If your database tables are corrupted, WordPress can&rsquo;t retrieve data from them. Fortunately, WordPress includes a built-in database repair mode that you can activate.<\/p><p>Follow these steps to repair your database:<\/p><ol class=\"wp-block-list\">\n<li>Open your <strong>wp-config.php<\/strong> file using the <strong>File Manager<\/strong>.<\/li>\n\n\n\n<li>Add the following line of code at the bottom of the file:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define('WP_ALLOW_REPAIR', true);<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Save the changes.<\/li>\n\n\n\n<li>In your browser, go to <strong>http:\/\/your-site-domain.com\/wp-admin\/maint\/repair.php<\/strong>, replacing <strong>your-site-domain.com<\/strong> with your actual website URL.<\/li>\n\n\n\n<li>On that page, you&rsquo;ll see two options. Click <strong>Repair Database<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1c3ccb93c0\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"543\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/wordpress-admin-repair-database-highlighted-1024x543.png\" alt=\"Screenshot of the WordPress admin repair database page with the Repair Database button highlighted.\" class=\"wp-image-134839\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Once the process finishes, revisit your website. If it loads correctly, remove the line <strong>define(&lsquo;WP_ALLOW_REPAIR&rsquo;, true); <\/strong>from your <strong>wp-config.php<\/strong> file immediately. Leaving it enabled is a security risk because anyone could access that repair page.<\/p><h3 class=\"wp-block-heading\" id=\"h-4-replace-corrupted-core-files\">4. Replace corrupted core files<\/h3><p>Corrupted WordPress core files can also interfere with the database connection. This often happens during a manual update or due to a file transfer error. You can fix it by replacing your core files with a fresh copy.<\/p><p>Here are the instructions:<\/p><ol class=\"wp-block-list\">\n<li>Go to the official <a href=\"https:\/\/wordpress.org\/download\" target=\"_blank\" rel=\"noopener\">WordPress.org website<\/a> and download the latest version.<\/li>\n\n\n\n<li>Extract the ZIP file on your computer.<\/li>\n\n\n\n<li>Inside the extracted folder, delete the <strong>wp-content<\/strong> folder and the <strong>wp-config-sample.php<\/strong> file.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1c3ccbace4\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"972\" height=\"772\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/macos-finder-wordpress.png\" alt=\"Screenshot of macOS Finder window displaying extracted WordPress installation files.\" class=\"wp-image-134844\"  sizes=\"auto, (max-width: 972px) 100vw, 972px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>Connect to your website using an <a href=\"\/ca\/tutorials\/ftp\/filezilla-ftp-configuration\">FTP client like FileZilla<\/a> or your host&rsquo;s <strong>File Manager<\/strong>.<\/li>\n\n\n\n<li>Upload the remaining files and folders to your website&rsquo;s root directory, overwriting the existing ones.<\/li>\n<\/ol><p>This process replaces all the core files without touching your content, themes, or plugins. After the upload is complete, check your website again.<\/p><h3 class=\"wp-block-heading\" id=\"h-5-create-a-new-database-and-restore-from-backup\">5. Create a new database and restore from backup<\/h3><p>If your database is severely corrupted and can&rsquo;t be repaired, the best solution is to <a href=\"\/support\/4283700-how-to-restore-backups-at-hostinger\">restore it from a backup<\/a>. This process involves creating a new, empty database and importing your backup file into it.<\/p><p>Here&rsquo;s how to do it with Hostinger:<\/p><ol class=\"wp-block-list\">\n<li>In hPanel, go to <strong>Files &rarr; Backups &rarr; Restore and download<\/strong>.<\/li>\n\n\n\n<li>Select <strong>Database backups<\/strong>, choose the latest clean backup, and click <strong>Download database<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1c3ccbbe23\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"353\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/hpanel-websites-files-backups-download-database-highlighted-1024x353.png\" alt=\"Screenshot of Hostinger hPanel showing the Files &rarr; Backups section with the Download database option highlighted.\" class=\"wp-image-134857\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Navigate to <strong>Databases &rarr; Management<\/strong>, enter a new database name, username, and password, then click <strong>Create<\/strong>.<\/li>\n\n\n\n<li>Scroll down to your new database and click <strong>Enter phpMyAdmin<\/strong>.<\/li>\n\n\n\n<li>Select the <strong>Import<\/strong> tab, choose your downloaded backup file, and hit <strong>Import<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1c3ccbcffa\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"689\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/phpmyadmin-import-selected-1024x689.png\" alt=\"Screenshot of phpMyAdmin&rsquo;s Import tab with a backup file selected for upload.\" class=\"wp-image-134858\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"5\" class=\"wp-block-list\">\n<li>Open your <strong>wp-config.php<\/strong> file and update the <strong>DB_NAME<\/strong>, <strong>DB_USER<\/strong>, and <strong>DB_PASSWORD<\/strong> values to match the new database you created.<\/li>\n<\/ol><h3 class=\"wp-block-heading\" id=\"h-6-update-the-wordpress-website-url\">6. Update the WordPress website URL<\/h3><p>If the error appears right after <a href=\"\/ca\/tutorials\/how-to-migrate-wordpress\">migrating your WordPress site<\/a> to a new server or domain, it indicates a misconfigured site URL in the database. You can fix this by <a href=\"\/ca\/tutorials\/wordpress\/how-to-change-wordpress-urls-in-mysql-database-using-phpmyadmin\">updating the WordPress site URL in phpMyAdmin<\/a>.<\/p><p>    <p class=\"warning\">\n        <strong>Warning!<\/strong> Running SQL queries directly can be risky if you&rsquo;re not careful. Always back up your database before making changes in phpMyAdmin.    <\/p>\n    \n\n\n\n<\/p><p>Follow these steps:<\/p><ol class=\"wp-block-list\">\n<li>Open <strong>phpMyAdmin<\/strong> from your hosting control panel.<\/li>\n\n\n\n<li>Select your WordPress database from the list on the left.<\/li>\n\n\n\n<li>Click the <strong>SQL<\/strong> tab.<\/li>\n\n\n\n<li>Enter the following queries, replacing <strong>http:\/\/www.old-domain.com<\/strong> with your old URL and <strong>http:\/\/www.new-domain.com<\/strong> with your new one:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">UPDATE wp_options SET option_value = replace(option_value, 'http:\/\/www.old-domain.com', 'http:\/\/www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';\nUPDATE wp_posts SET guid = replace(guid, 'http:\/\/www.old-domain.com','http:\/\/www.new-domain.com');\nUPDATE wp_posts SET post_content = replace(post_content, 'http:\/\/www.old-domain.com', 'http:\/\/www.new-domain.com');\nUPDATE wp_postmeta SET meta_value = replace(meta_value,'http:\/\/www.old-domain.com','http:\/\/www.new-domain.com');<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1c3ccbe3ba\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"464\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/phpmyadmin-sql-selected-1024x464.png\" alt=\"Screenshot of phpMyAdmin with the SQL tab selected to run custom database queries.\" class=\"wp-image-134864\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"5\" class=\"wp-block-list\">\n<li>Click <strong>Go<\/strong> to execute the queries.<\/li>\n<\/ol><h3 class=\"wp-block-heading\" id=\"h-7-make-sure-your-domain-points-to-the-right-host\">7. Make sure your domain points to the right host<\/h3><p>After a migration, it&rsquo;s crucial that your domain&rsquo;s DNS settings point to your new hosting provider. If your domain still points to the old host, WordPress will attempt to connect to the old database, which causes an error.<\/p><p>To check this, verify your domain&rsquo;s nameservers. If both your domain and website are hosted at Hostinger, the nameservers are set automatically. In this case, you don&rsquo;t need to change anything.<\/p><p>If you host your website with Hostinger but registered your domain elsewhere, you can find your nameservers under <strong>Websites &rarr; Website list &rarr; Dashboard &rarr; Hosting Plan &rarr; Plan details<\/strong>.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1c3ccbf67a\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"333\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/hpanel-websites-hosting-plan-details-current-nameserver-1-2-highlighted-1024x333.png\" alt=\"Screenshot of Hostinger hPanel Hosting Plan details page with the current nameservers highlighted.\" class=\"wp-image-134875\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Next, use a tool like <a href=\"https:\/\/dnschecker.org\" target=\"_blank\" rel=\"noopener\">DNS Checker<\/a> to confirm where your domain is currently pointing. If the nameservers are incorrect, log in to your domain registrar&rsquo;s control panel and point them to Hostinger&rsquo;s nameservers.<\/p><p>If you <a href=\"\/ca\/domain-name-search\">registered your domain with Hostinger<\/a> but host your site with another provider, the process is similar but reversed. You&rsquo;ll need to get the correct nameservers from your hosting provider, then <a href=\"https:\/\/support.hostinger.com\/en\/articles\/1696789-how-to-change-nameservers-at-hostinger\" target=\"_blank\" rel=\"noopener\">update them in Hostinger<\/a>:<\/p><ol class=\"wp-block-list\">\n<li>Go to <strong>Domains &rarr; Domain portfolio &rarr; Manage<\/strong>.<\/li>\n\n\n\n<li>In the <strong>DNS \/ Nameserver<\/strong> section, open the <strong>DNS records<\/strong> tab.<\/li>\n\n\n\n<li>Click <strong>Change nameservers<\/strong> and enter the new nameservers provided by your host.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1c3ccc08c9\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"465\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/hpanel-domain-portfolio-dns-nameservers-change-nameservers-highlighted-1024x465.png\" alt=\"Screenshot of Hostinger hPanel Domain Portfolio DNS\/Nameservers section with the Change nameservers button highlighted.\" class=\"wp-image-134876\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>After changing nameservers, keep in mind that DNS updates can take up to <strong>24 hours<\/strong> to propagate worldwide.<\/p><h3 class=\"wp-block-heading\" id=\"h-8-contact-your-hosting-provider-or-reboot-the-server\">8. Contact your hosting provider or reboot the server<\/h3><p>If you&rsquo;ve tried all the previous steps and the error still persists, it&rsquo;s time to contact your hosting provider. Their support team has server-level access and the right tools to diagnose complex issues.<\/p><p>Hostinger&rsquo;s <a href=\"\/ca\/contacts\">Customer Success<\/a> team is available 24\/7 to help resolve these problems.<\/p><p>If you use a virtual private server (VPS), you also have the option to reboot it. A reboot can clear temporary glitches or stop processes that are consuming too many server resources and blocking the database from responding.<\/p><p>For <a href=\"\/ca\/vps-hosting\">Hostinger VPS<\/a> customers, the <strong>Reboot VPS<\/strong> button is available on your <strong>VPS Overview<\/strong> page.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1c3ccc1ac7\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"404\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/hpanel-vps-overview-reboot-vps-highlighted-1024x404.png\" alt=\"Screenshot of Hostinger hPanel VPS Overview page with the Reboot VPS button highlighted.\" class=\"wp-image-134877\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p><div class=\"protip\">\n                    <h4 class=\"title\">&#128161; Pro tip<\/h4>\n                    <p>Always <a href=\"\/support\/1583232-how-to-back-up-or-restore-a-vps-at-hostinger\">back up your VPS<\/a> before rebooting it. This way, you can quickly restore your site if something unexpected happens during the restart.<\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-prevent-database-connection-errors-in-wordpress\">How to prevent database connection errors in WordPress<\/h2><p>Preventing database connection errors in WordPress involves <strong>enabling automated site backups, optimizing database tables, using trusted plugins and themes, choosing a reliable hosting provider, and monitoring your site&rsquo;s resource usage<\/strong>.<\/p><ul class=\"wp-block-list\">\n<li><strong>Enable automated backups<\/strong>. This lets you quickly restore your database if it becomes corrupted. Hostinger plans include automatic daily or weekly backups, so you always have a recent version of your site to fall back on.<\/li>\n\n\n\n<li><strong>Regularly optimize database tables<\/strong>. Over time, your database accumulates unnecessary data. Use a plugin like <strong>WP-Optimize<\/strong> to clean up your database, improve performance, and reduce the risk of corruption.<\/li>\n\n\n\n<li><strong>Use trusted plugins and themes<\/strong>. Only install plugins and themes from reputable sources like the official WordPress repository. Poorly coded software is a common cause of database conflicts and corruption.<\/li>\n\n\n\n<li><strong>Choose a reliable hosting provider<\/strong>. A quality web host like Hostinger provides an optimized server environment for MySQL, minimizing the risk of server-side errors and downtime.<\/li>\n\n\n\n<li><strong>Monitor database traffic and load<\/strong>. Keep an eye on your site&rsquo;s resource usage. If you consistently hit your server&rsquo;s limits, consider upgrading your hosting plan to prevent the database server from becoming overloaded.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-what-to-do-after-fixing-error-establishing-a-database-connection\">What to do after fixing &ldquo;Error establishing a database connection&rdquo;?<\/h2><p>After fixing &ldquo;Error establishing a database connection&rdquo; in WordPress, the next step is to <strong>keep your database running smoothly to avoid future problems<\/strong>.<\/p><p>A clean and optimized database not only reduces the risk of corruption but also improves your site&rsquo;s overall speed.<\/p><p>To maintain long-term site health, learn how to <a href=\"\/ca\/tutorials\/wordpress-database-optimization\">optimize your WordPress database<\/a> using the right tools and best practices. This will help your site stay stable and perform at its best as it grows.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&ldquo;Error establishing a database connection&rdquo; in WordPress means your website cannot communicate with its MySQL database, preventing the site from loading and showing an error message instead. This problem usually comes from incorrect database credentials in the configuration file, a corrupted database, or an unresponsive server. To fix it, check your credentials, repair the database, [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ca\/tutorials\/how-to-fix-error-establishing-a-database-connection-in-wordpress\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":337,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to fix \"Error establishing a database connection\" in WordPress","rank_math_description":"Can't connect to your WordPress database? Find 8 proven methods to fix \"Error establishing a database connection\" and get your site back online.","rank_math_focus_keyword":"error establishing a database connection","footnotes":""},"categories":[22692],"tags":[],"class_list":["post-583","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-fix-error-establishing-a-database-connection-in-wordpress","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-fix-error-establishing-a-database-connection-in-wordpress","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-fix-error-establishing-a-database-connection-in-wordpress","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-fix-error-establishing-a-database-connection-in-wordpress","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-fix-error-establishing-a-database-connection-in-wordpress","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-fix-error-establishing-a-database-connection-in-wordpress","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-fix-error-establishing-a-database-connection-in-wordpress","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-fix-error-establishing-a-database-connection-in-wordpress","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/users\/337"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/comments?post=583"}],"version-history":[{"count":111,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/583\/revisions"}],"predecessor-version":[{"id":141347,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/583\/revisions\/141347"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/media?parent=583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/categories?post=583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/tags?post=583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}