techinfoBiT
  • News
  • Startups
  • Tech
    • Internet
    • Security
  • WebMaster
    • All
    • GEO
    • SEO
    • Server & Hosting
    • Tools
    • WordPress
    Why Your Business Emails Go to Spam: SPF, DKIM and DMARC Explained - techinfoBiT

    Why Your Business Emails Go to Spam: SPF, DKIM and DMARC Explained

    'Sorry, This File Type Is Not Permitted for Security Reasons' How To Fix This Error in WordPress Website Development-techinfoBiT

    ‘Sorry, This File Type Is Not Permitted for Security Reasons’ How To Fix This Error in WordPress

    What is DMARC Record in DNS and Why It is Important For Email Security-techinfoBiT

    What is DMARC Record in DNS and Why It is Important For Email Security?

    How To Generate SHA-256 Hash From the Command Line on Ubuntu Server - techinfoBiT-SHA-256,Ubuntu Server, Server Solution, Linux Hashing, File Integrity, Cryptographic Hash, sha256sum, Hash Generation

    How To Generate SHA-256 Hash From the Command Line on Ubuntu Server

    Cloudflare To Deprecate Auto Minify Feature On August 5, 2024 - techinfoBiT

    Cloudflare To Deprecate Auto Minify Feature On August 5, 2024

    What is Google Analytics 4 and How to Setup GA4 for Websites - techinfoBiT

    What is Google Analytics 4 and How to Setup GA4 for Websites?

  • Science Space
  • Gadgets
    • Laptop & PCs
    • Mobile Phones
    • Wearables
  • More
    • How-To Guides
    • Reviews
    • Telecom
    • Applications
    • Press Release
No Result
View All Result
Services
techinfoBiT
  • News
  • Startups
  • Tech
    • Internet
    • Security
  • WebMaster
    • All
    • GEO
    • SEO
    • Server & Hosting
    • Tools
    • WordPress
    Why Your Business Emails Go to Spam: SPF, DKIM and DMARC Explained - techinfoBiT

    Why Your Business Emails Go to Spam: SPF, DKIM and DMARC Explained

    'Sorry, This File Type Is Not Permitted for Security Reasons' How To Fix This Error in WordPress Website Development-techinfoBiT

    ‘Sorry, This File Type Is Not Permitted for Security Reasons’ How To Fix This Error in WordPress

    What is DMARC Record in DNS and Why It is Important For Email Security-techinfoBiT

    What is DMARC Record in DNS and Why It is Important For Email Security?

    How To Generate SHA-256 Hash From the Command Line on Ubuntu Server - techinfoBiT-SHA-256,Ubuntu Server, Server Solution, Linux Hashing, File Integrity, Cryptographic Hash, sha256sum, Hash Generation

    How To Generate SHA-256 Hash From the Command Line on Ubuntu Server

    Cloudflare To Deprecate Auto Minify Feature On August 5, 2024 - techinfoBiT

    Cloudflare To Deprecate Auto Minify Feature On August 5, 2024

    What is Google Analytics 4 and How to Setup GA4 for Websites - techinfoBiT

    What is Google Analytics 4 and How to Setup GA4 for Websites?

  • Science Space
  • Gadgets
    • Laptop & PCs
    • Mobile Phones
    • Wearables
  • More
    • How-To Guides
    • Reviews
    • Telecom
    • Applications
    • Press Release
No Result
View All Result
techinfoBiT

What is “Error Establishing a Database Connection” in WordPress and How to Fix It

Nishant Kumar by Nishant Kumar
December 31, 2018
Reading Time: 4 mins read
Share on FacebookShare on Twitter > XShare via WhatsAppShare on LinkedIn

Error Establishing a Database Connection is one of those frustrating issues which could be caused by many reasons. As a WordPress beginner, it’s very painful to see these type of issues especially when you haven’t made any changes to the website.

We ran into this issue several times on my own site. While doing the research to find possible causes, I found many articles and tried all of them but nothing works for me lastly I got something from host’s Q&A, so I will show you how to fix the error establishing a database connection in WordPress. But before the solution, we must know about the problem so:

You might also like

How to Fix a FastAPI 502 Error Caused by a Missing Python Dependency - techinfoBiT

How to Fix a FastAPI 502 Error Caused by a Missing Python Dependency

June 17, 2026
Why Your Business Emails Go to Spam: SPF, DKIM and DMARC Explained - techinfoBiT

Why Your Business Emails Go to Spam: SPF, DKIM and DMARC Explained

June 15, 2026

What is "Error Establishing a Database Connection" in WordPress and How to Fix It - techinfoBiT

Why do You Get Error Establishing a Database Connection?

The error occurs because of WordPress were unable to establish a database connection. Now the reason why WordPress is unable to establish a database connection can vary. It could be that your database Login credentials are wrong or have been changed. It could be that your database server is unresponsive. It could be that your database has been corrupted. In my case, this was happening because my MySQL getting down automatically due to high memory load. Lets take a look at how to go about troubleshooting this problem.

  • Revised the database settings from wp-config database username, password and database name. 
  • Checking Web Host (MySQL Server) if there is any issue with the host because sometimes host server can’t handle much load (specially when you are on shared hosting). Your site will get really slow and for some users even output the error. So the best thing you should do is get on the phone or livechat with your hosting provider and ask them if your MySQL server is responsive.

Solution Which Worked for Me:- If the database connection settings from wp-config is correct then chances are issues is being caused by the heavy server load or low server resources. If some sites getting high traffic than it needs more memory to handle that traffic if your site is hosted on a shared server than you can talk with the host to upgrade your plan, and those who have VPS can add swapfile.

So What is Swapping and How to Add Swap on Linux Server?

About Linux Swapping:- Linux RAM is composed of chunks of memory called pages. To free up pages of RAM, a “linux swap” can occur and a page of memory is copied from the RAM to preconfigured space on the hard disk. Linux swaps allow a system to harness more memory than was originally physically available. Check for Swap Space Before we proceed to set up a swap file, we need to check if any swap files have been enabled on the VPS by looking at the summary of swap usage.

sudo swapon -s

An empty list will confirm that you have no swap files enabled:

Filename			Type		Size	Used	Priority

Check the File System: After we know that we do not have a swap file enabled on the virtual server, we can check how much space we have on the server with the df command. The swap file will take 512MB— since we are only using up about 8% of the /dev/sda, we can proceed.

df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda        20907056 1437188  18421292   8% /
udev              121588       4    121584   1% /dev
tmpfs              49752     208     49544   1% /run
none                5120       0      5120   0% /run/lock
none              124372       0    124372   0% /run/shm

Create and Enable the Swap File: Now it’s time to create the swap file itself using the dd command,

sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k

“of=/swapfile” designates the file’s name. In this case, the name is swapfile. Subsequently, we are going to prepare the swap file by creating a linux swap area:

sudo mkswap /swapfile

The results display:

Setting up swapspace version 1, size = 262140 KiB
no label, UUID=103c4545-5fc5-47f3-a8b3-dfbdb64fd7eb

Finish up by activating the swap file:

sudo swapon /swapfile

You will then be able to see the new swap file when you view the swap summary.

swapon -s
Filename				Type		Size	Used	Priority
/swapfile                               file		262140	0	-1

This file will last on the virtual private server until the machine reboots. You can ensure that the swap is permanent by adding it to the fstab file. Open up the file:

sudo nano /etc/fstab

Paste in the following line:

 /swapfile       none    swap    sw      0       0

To prevent the file from being world-readable, you should set up the correct permissions on the swap file:

sudo chown root:root /swapfile 
sudo chmod 0600 /swapfile

Thats all, hope this will resolve your problem.

Tags: Create Virtual MemoryError Establishing a Database ConnectionHow ToHow to Create Swap MemoryServerSpeed up Linux ServerUbuntuWebMasterWordPressWordPress Database Connection Issues
ShareTweetSendShare
Previous Post

Best IM or Social Apps for iPhone, Android, Symbian and Windows Phones to Reduce your Phone Bill

Next Post

Nokia’s First Dual Sim Windows Phone, Nokia Lumia 720 Dual Sim Might be in The Making

Nishant Kumar

Nishant Kumar

Nishant is a passionate tech blogger and has been writing about technology since 2007. His insatiable love for gadgets has made him closely follow the advancements & innovations our society has made in terms of technology since a long while now. Nishant is a highly sought after reviewer with many manufacturers requesting his opinions about their products. He covers Mobile Phones, Gadgets, Tools and all kind of tech products to give consumers Genuine Reviews, Buying Guides and reliable news.

Related Articles

How to Fix a FastAPI 502 Error Caused by a Missing Python Dependency - techinfoBiT

How to Fix a FastAPI 502 Error Caused by a Missing Python Dependency

by Nishant Kumar
June 17, 2026
0

A 502 Bad Gateway is deceptive. The error shows up at the browser or API client, but the actual cause could be sitting anywhere: a crashed process, a misconfigured proxy,...

Why Your Business Emails Go to Spam: SPF, DKIM and DMARC Explained - techinfoBiT

Why Your Business Emails Go to Spam: SPF, DKIM and DMARC Explained

by Nishant Kumar
June 15, 2026
0

Email remains one of the most important communication channels for businesses. Whether it is a sales proposal, invoice, customer support response, order confirmation, password reset email, or marketing campaign, organisations...

Synology DS File Upload Reaches 100percent Then Fails? Failed to Upload Files on NAS - techinfoBiT

Synology DS File Upload Reaches 100% Then Fails? Failed to Upload Files on NAS

by Nishant Kumar
June 13, 2026
0

Many Synology NAS users encounter a frustrating issue when uploading files via DS File. The upload appears to complete successfully, reaches 100%, enters the "Processing" stage, and then suddenly fails...

How to Install Let's Encrypt SSL on Ubuntu 24.04 VPS, Free HTTPS for All Website - techinfoBiT

How to Install Let’s Encrypt SSL on Ubuntu 24.04 VPS, Free HTTPS for All Websites

by Nishant Kumar
June 3, 2026
0

One of the final and most important steps when launching a website or web application is enabling HTTPS. Whether you're hosting a WordPress website, a Spring Boot application, a Laravel...

Load More
Next Post
Nokia's First Dual Sim Windows Phone, Nokia Lumia 720 Dual Sim Might be in The Making - techinfoBiT

Nokia's First Dual Sim Windows Phone, Nokia Lumia 720 Dual Sim Might be in The Making

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.

techinfoBiT | Startup & Tech News, Reviews | WebMaster, How-To Guides-Tech Blog-Startup Blog India

techinfoBiT is your go-to source for the latest startup & tech news, technology reviews; WebMaster, SEO tips and how-to guides to help you stay updated and navigate the digital world know more

  • About
  • Contacts
  • Disclaimer
  • Privacy Policy

© 2012-2025 techinfoBiT | All Rights Reserved

No Result
View All Result
  • News
  • Startups
  • Tech
  • WebMaster
  • Gadgets
  • How-To Guides
  • Science Space
  • Services

© 2012-2025 techinfoBiT | All Rights Reserved