Another Wordpress site.
Browse to explore new tactics about blogging and make money with web technologies, that make you #webtechpreneur
Email: [email protected]
Every WordPress user face and fix minimum one time this error ” Error Establishing a Database Connection ” and this error is generated when WordPress database is not connected to WordPress site correctly. because every data of WordPress is stored in the database so while fetching data from a database with wrong database configuration this error occurs.
There are some reasons behind ” Error Establishing a Database Connection ” . there can be a missed match communication between database connection or a corrupted files that configure the database credentials.
There are some of reasons behind the ” Error Establishing a Database Connection ” error :
Note: Before you make any database changes, make sure you have whole backup of databse.
Before starting check database credentials that is right or wrong. WordPress database is configure in the wp-config.php file. in this file database and its login details is defined. this is where you specify the details for WordPress to connect your database. If you changed your root password, or the database user password, then you will need to change this file as well. First thing you should always check is if everything in your wp-config.php file is the same.
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'database_name_here' ); /** MySQL database username */ define( 'DB_USER', 'username_here' ); /** MySQL database password */ define( 'DB_PASSWORD', 'password_here' ); /** MySQL hostname */ define( 'DB_HOST', 'localhost' );
If anyone of these values is incorrect, WordPress will not be able to connect to the database. and the problem is cause this issue to fix it with right WordPress database login details.
if all the defined credentials are right and error still show then go to second method that is checking WordPress corrupted file.
Wp-config.php file contains the all the database login details and other details that overcome with installation of plugin or by WordPress installation.
so if all the database login right then takes a lightly look on wp-config.php file. for help in the WordPress directory, there is also wp-config-sample.PHP file in the just above on wp-config.php file that contain same codes like wp-config but just in the initial condition. so open the wp-config-sample.php file and compare it with wp-config.php. and check all the basic function are defined in wp-config file same as the wp-config-sample file.
it is also become a great thankful solution for me on nativetechie, while i causes by below error
Modify database can be done by cPanel or WordPress. both method check or repair database, before taking any action please make sure you have a database backup.
Login to your cPanel and go to MySql Databases here is a section of Modify database here you can check or repair database.
Can you see your website normally, but get the error when trying to access wp-admin? Or maybe your website is down, but you’re getting a slightly different error when you try to login: “One or more database tables are unavailable. The database may need to be repaired.”
WordPress has a built-in way to attempt to repair your database, but you’ll have to enable this feature first. To do so, you’ll need to access your wp-config.php file, which contains your WordPress installation settings and configuration.
You can find wp-config in the your root WordPress file directory. You can access it by logging into your cPanel, selecting File Manager, and navigating to the folder where you installed WordPress.
Once you have wp-config open, add this line of code to the bottom:
define( 'WP_ALLOW_REPAIR', true );
This line will enable you to optimize and repair your database by navigating to www.yourwebsite.com/wp-admin/maint/repair.php (just replace “yourwebsite.com” with your actual URL).
Warning! After repair database remove the added line from wp-config.php file
Using above three methods and still error appearing then its time to make new database login credential. database login can be modified or make in the cPanel of hosting provider. database login details are database_username and database_password.
I have tried this method and got a positive result.
For making new username and password simply try below steps in cpanel.
add new user with required form details and noted this details because now this detail will be replaced in the wp-config.php file.
Now add new user into wp-config.php file where database details are saved.
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'database_name_here' ); /** MySQL database username */ define( 'DB_USER', 'new_username_here' ); /** MySQL database password */ define( 'DB_PASSWORD', 'new_password_here' ); /** MySQL hostname */ define( 'DB_HOST', 'localhost' );
And then run WordPress site. i hope you have overcome from this problem.
If you’ve followed the above troubleshooting steps and your website is still down, it could be a problem on your host’s end. Contact your web hosting company’s support and give them all the details of the error and the troubleshooting actions you’ve taken, and they may be able to help you determine the cause of the error.
share your error story and help people to overcome with this preoblem.
After 7 years of Internet meeting, 3 years of web technology experience, 2 unsuccessful Blogs, 1 failed youtube channel, 1 StartUp failure and 3 days of internship here I am writing.
And one day definitely, you and I will be Web Tech Preneur.
Recover your password.
A password will be e-mailed to you.