Cross Domain & Live Template Copy Addon for Site
2000+ ready blocks, header-footer, pages, & templates
Add awesome floating animation to any elements
Customize tooltip with images, gifs, & backgrounds
Make every widgets & content equal of heights
Select content audience from roles and browsers
Add dynamic links to any thing on your website
Add background overlay color to widgets & sections
Display lots of party popper particles in any section
One-click to duplicate whole page, post & template
Snappy particle animations for your live website
Customize widget dimension beyond normal scale
Embed content, site, media within your website
Customizable cursor button for professional web design
Dynamic grids for easy web design maneuvers
Fully custom grid and carousel for posts (single)
Discrete navigation controls for carousel widgets
Highlight text or heading with marker notations
Turn section backgrounds into interactive galleries
Dynamic horizontal scrolling slider widget in action
Crafted page templates to help you get started with your landing page just by dropping a starter design
Ready Blocks comes with a variety of layouts and design elements, such as headers, footers, and widgets etc.
Pre-designed headers with lucrative styles that are suitable for various niche websites and design tastes
A helpful collection of footer designs to help you create an instant attractive footer on your landing page
Find us 24/7 at your service. We are glad to help.
Detailed guidelines available for every features at BdThemes
Learn something new, stay informed about WordPress, Web Design and more
Here are some of the key milestones in my development:
Learn product usage, WordPress tips & tricks from our videos
Earn hefty commissions by joining us in the promotion
Widget Idea Share is a great way to find similar widgets that you can improve.
Certainly! If you need to get in touch with us feel free to reach out
The zoloblocks plugin which lets you create stunning websites using the gutenberg site builder
Most superior Slider in the Era of Elementor Slider
The only Compatible blogging widgets in Elementor for any Blog
Create next gen e-commerce website for your business in WordPress
Organize your photos in a different angel every time with Elementor
Boost your website engagement and drive more sales with Spin Wheel WordPress plugin.
The AI Image Generator Plugin for WordPress is a powerful tool by ChatGPT
Get 360° Augmented Reality for WooCommerce today!
Copy & Paste any web design you like just with 2 clicks!
A fully functioning theme for elementor with unlimited options
Showcase customer feedback and reviews to build trust and credibility.
Get amazing Flyers, visiting card, Logo template from here
Cross Domain & Live Template Copy Addon for Site
2000+ ready blocks, header-footer, pages, & templates
Add awesome floating animation to any elements
Customize tooltip with images, gifs, & backgrounds
Make every widgets & content equal of heights
Select content audience from roles and browsers
Add dynamic links to any thing on your website
Add background overlay color to widgets & sections
Display lots of party popper particles in any section
One-click to duplicate whole page, post & template
Snappy particle animations for your live website
Customize widget dimension beyond normal scale
Embed content, site, media within your website
Customizable cursor button for professional web design
Dynamic grids for easy web design maneuvers
Fully custom grid and carousel for posts (single)
Discrete navigation controls for carousel widgets
Highlight text or heading with marker notations
Turn section backgrounds into interactive galleries
Dynamic horizontal scrolling slider widget in action
Crafted page templates to help you get started with your landing page just by dropping a starter design
Ready Blocks comes with a variety of layouts and design elements, such as headers, footers, and widgets etc.
Pre-designed headers with lucrative styles that are suitable for various niche websites and design tastes
A helpful collection of footer designs to help you create an instant attractive footer on your landing page
Find us 24/7 at your service. We are glad to help.
Detailed guidelines available for every features at BdThemes
Learn something new, stay informed about WordPress, Web Design and more
Here are some of the key milestones in my development:
Learn product usage, WordPress tips & tricks from our videos
Earn hefty commissions by joining us in the promotion
Widget Idea Share is a great way to find similar widgets that you can improve.
Certainly! If you need to get in touch with us feel free to reach out
The zoloblocks plugin which lets you create stunning websites using the gutenberg site builder
Most superior Slider in the Era of Elementor Slider
The only Compatible blogging widgets in Elementor for any Blog
Create next gen e-commerce website for your business in WordPress
Organize your photos in a different angel every time with Elementor
Boost your website engagement and drive more sales with Spin Wheel WordPress plugin.
The AI Image Generator Plugin for WordPress is a powerful tool by ChatGPT
Get 360° Augmented Reality for WooCommerce today!
Copy & Paste any web design you like just with 2 clicks!
A fully functioning theme for elementor with unlimited options
Showcase customer feedback and reviews to build trust and credibility.
Get amazing Flyers, visiting card, Logo template from here
The message “Error Establishing a Database Connection” is a particularly frustrating WordPress error in which the entire site is replaced by a notice that looks like this:
If you are reading this post, there is a good chance that you are experiencing this error right now.
If not, you have a good luck. All WordPress users get this message in their lifetime at least once!
And even if you are not getting this message in your website, learning to fix this issue of “error establishing a database connection” for WordPress is a must know for you.
In this post, you will learn three things:
If you are not familiar with the operation of WordPress, there are two essential parts of a website:
Your files – this includes WordPress application, your themes, your plugins, your multimedia uploads, etc.
Your database – this is where the actual content of your comments, posts, and pages is stored (as well as a lot of other important information such as meta information).
Every time a visitor lands on your WordPress site, the PHP files query in your database to determine exactly what information to display.
Without a functional connection to the database, the PHP file part of your WordPress site will not be able to get the information you need to render a webpage properly. That’s why it shows the “error establishing a database connection” message instead.
There are multiple potential reasons why you are seeing this message.
Most of the time , these causes are related to:
Because of the fact that you can not be sure what is causing the message for your specific situation, the best way to fix the problem is to take a diagnostic approach.
That is, you need to systematically follow a series of tests to isolate (and then fix) the problem.
The systematic approaches are listed is the order those need to be done:
When you see this message on the front-end of your site, the first thing to do is to check whether or not you get the same error when you try to access your administrator control panel in WordPress (wp-admin dashboard).
If you still see the same error message when you try to access your wp-admin area, skip to the next step. You have already eliminated this problem as a potential cause.
If you see a different message mentioning something like “The database may need to be repaired,” continue with this section to learn how to repair your WordPress database.
Step 1: Activate the repair utility in the wp-config.php file.
To begin with, you need to edit the wp-config.php file for your site. You can do this for either of them:
Connecting to your site through FTP. ( FileZilla is a good program for that)
Using the integrated cPanel File Manager tool ( cPanel’s built-in File Manager).
Your wp-config.php file is located in the root folder/directory of your WordPress website. It is the same folder that contains wp-admin and wp-content directory/folder:
Once you can edit your wp-config.php file , add this short code snippet at the end:
define('WP_ALLOW_REPAIR', true);
Make sure to save the changes before continuing to the next step.
Step 2: Run the automatic database repair utility.
Once you have added the code snippet, you can access the WordPress database repair tool by going to:
yourdomain/wp-admin/maint/repair.php
On that page appears, click Repair database to run the tool:
Once the tool completes its repairs, your site should work again. If it does, all you need to do is to go back to your wp-config.php file and delete the same line of code that you added to enable the repair utility.
If your site is still not working, continue with the next step.
If your database is not corrupted, the next thing to check is if your login credentials for the database are working.
Your database credentials are defined in the wp-config.php file :
/** MySQL database username */
define('DB_USER', 'yourusername');
/** MySQL database password */
define('DB_PASSWORD', 'yourdbpassword');
If this information does not match the credentials of the database that you created through the hosting control panel, WordPress will not be able to access that database.
To test if your database credentials are working, you can use the mysqli_connect () function.
Use a text editor such as Notepad to create a file called dbcheck.php.
Then, add this snippet of code to the file:
<?php
$con = mysqli_connect("localhost","mysql_user","mysql_password","mysql_db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
Make sure to replace “mysql_user” and “mysql_password” with the current username and password of your wp-config.php file. And, also don’t forget to change the mysql_db name.
Then, upload that file to your website through cPanel or FTP and access it by going to:
yourdomain.com/dbcheck.php
If a message appears that says “Connected correctly”, the credentials of the database is working correctly and you can proceed to the next step.
But, if you see a message like the one below, you have a problem with your database credentials:
The easiest way to solve the problem is to create a new set of database credentials to use on your WordPress site.
Assuming that your host uses cPanel, you can create a new database user by going to the MySQL Databases option in your cPanel control panel:
Scroll down to the MySQL Users area and look for the Add a new user box.
Enter a new one:
Username.
Password.
Make sure you remember these details since you will need them in a second. Better to note down in a notepad/text file.
After creating a new user, go to the option Add a user to a database and add the new user to the database of your WordPress site:
On the next screen, be sure to give the user ALL THE PRIVILEGES :
To finish, you must go back to the wp-config.php file of your site and update the DB_USER and DB_PASSWORD fields to the new user:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'yourdbname');
/** MySQL database username */
define('DB_USER', 'yourdbuser');
/** MySQL database password */
define('DB_PASSWORD', 'yourbdpass');
/** MySQL hostname */
define('DB_HOST', 'localhost');
Make sure you change, yourdbname, yourdbuser,yourdbpass and if needed server host from localhost to your hosting provided one.
Once you save your changes, your site should be working again!
If none of the above methods has corrected the error, some of the main WordPress files may be corrupted.
To make sure that this is not the problem, you can upload a new copy of WordPress to your site. If done well, this will not affect any of the content, plugins or existing topics.
Go to WordPress.org and download its latest version:
Then, extract the ZIP file and delete the wp-content folder and the wp-config-sample.php file :
Upload the remaining files to your WordPress site through FTP. When your FTP program asks you what to do with the duplicate files, make sure to choose the Overwrite duplicate files option.
This will ensure that none of your main WordPress files are corrupted, and the problem is expected to be fixed.
You may also read:
Essentials WordPress Plugins for Every WordPress Website
If none of the previous solutions worked, it’s possible that it’s just a hosting problem.
There are a couple of potential problems:
Your database server does not work Some hosts use a separate server for the databases, which means that your database may be down, even if your regular server is still running.
Your database has reached its quota. Some shared hosts limit the use of the database. If your site has reached its quota, that could explain why your database has fallen.
To solve these problems, you should talk to your host’s support team.
At this point, it is expected that you could fix the WordPress error establishing a database connection and have made your site work again.
Still, there are some smaller problems, which could also cause this error. These problems are often unique to your site and therefore are difficult to diagnose in a post like this.
If you still see the error message after going through these corrections and talking to your host, you may want to consider contacting a WordPress developer to investigate the problem further.
Or, you can always leave a comment and we hope we can all fix the problem together!
Change your mind? No problem. We offer a no-hassle, 14-days money back guarantee.
Largest Elementor Templates pack with the most user-friendly UI and 300+ useful Elementor widgets. Build websites from zero to 100% perfection in no time.
This website is powered by Element Pack Pro and Rooten Theme.
Copyright © 2025 BdThemes. All Rights Reserved.