How To Fix Error Establishing A Database Connection In Wordpress

October 3, 2022 32hotness 0likes 0comments


Cause of error

The main cause of the error Error establishing a database connection in wordpress is caused by tier: 1 is Server 2 is on wordpress source code itself. The cause on the Server may be a DB error, the DB service is stopped or it may be ddos ​​(maybe another site) leading to the death of the database. The cause on the Code is more common than the case on the Server, to mention that the Config is wrong Database, due to the theme or Plugin.

The first thing to identify the error and how to fix it is to think again about what you "just did" that could be the cause of the error. From there, localize and solve the error according to that cause. Otherwise, you will be "stunned" because you do not know what is the right way to handle it, mess it up, sometimes the web has more errors, not stopping at the database error.

Backup before fixing errors is also one of the actions to do before starting to fix errors.

More importantly! Hostagy supports to check and quickly handle this error, even if you do not use Hosting / VPS at Hostagy.

Special support policy only at Hostagy.vn

Hostagy is the only unit that supports Customers with issues that are not within the scope of mandatory Support. Completely free, you do not need to pay any extra cost.

  • Check and fix errors Error establishing a database connection in a few minutes.
  • Free SSL security certificate installation. Install enough steps, increase keyword rankings.
  • Free optimization to increase website speed. On average, the website is 2-15s faster than using Hosting elsewhere.
  • Support anti-malware... (read more)
You have not found information yet? Please chat directly with a counselor at the right corner of the screen or call 02466-567-555 for direct advice and support

What is error establishing a database connection error?

The error establishing a database connection error occurs when there is a database related problem in the Wordpress website. It could be a DB connection error or a Plugin conflict, or a DB error from the Server Hosting side. Depending on the cause of the error, there are different fixes, Please read this article carefully and fix the error according to the cause. If not, send a ticket / chat with a Hostagy consultant right at the bottom right corner of your screen!

Error establishing a database connection error due to incorrect user and password configuration in filw wp-config.php

This error is most common when you just transfer website data, change the config file or change the database password. The fix is ​​also very simple, how can the DB information on the hosting / server match with the wp-config File. Usually will change the password on Hosting, VPS then proceed to configure DB information in wp-config. If the host has many DBs, please open the config file and see which DB and then change it, otherwise change the wrong DB again

Step 1: Change Database password

If You use cPanel hosting, follow this guide

Login to cPanel => click "MySQL® Databases" => then scroll down to the bottom, select User to change in "Current Users" => Click "Change Password"
Then copy the newly changed Database information.

doi mat khau DB cPanel

If You use DirectAdmin follow this guide

Login Hosting => Click "MySQL Management" => Select the DB name to change => Click "modify password"

modify password Da

If you use other controlpanel/scripts, look for the same functionality as on DA and CP.

Step 2: Reconfigure the new password in wp-config . file

Using cPanel hosting, follow this guide

Click Home => Click "File Manager" => select the public_html folder, where the Source Code of the web needs to be edited => find the File named "wp-config.php" => Click the file name => click the "edit" button

wp config.php

config DB

If You use DirectAdmin follow this guide

Select "FILE MANAGER" => domains => select the domain to edit => public_html => scroll down to find the file wp-config.php, click the "edit" button on the same level as the wp-config file

config DB DA 1

config DB DA 2

If you use other controlpanel/scripts, look for the same functionality as on DA and CP.

=> check if the error is gone!

Lỗi Error establishing a database connection do theme hoặc Plugin

This error usually occurs when there is a plugin conflict, or due to a failed Database upgrade (upgrading the Wprdpress version for example). This error appears right after You install more Plugins / upgrade WP version.

Remedies:

Try disabling newly installed Plugins or suspect Plugins to see if that is the case. If yes, please use another plugin with similar features or ask a programming unit to support it.

Or you can check the backup, restore the source code and the error is gone.

Error establishing a database connection error due to Extenion not authorized in PHP version option

Depending on the PHP version, there are different ways to grant permissions. This situation occurs when You use Hosting with Cloudlinux installed. Please choose in the "PHP version" section => tick "Use Defaults" or make sure mysql related extensions are allowed.

Use Defaults

Other reasons on the user side

There are several other possible causes such as database corruption (lost, missing tables...)

The reason "Someone's beard is plugged in the other's chin" is that your domain name cannot be pointed to the IP Hosting / Server under test

Error "flickering", then you check to see if the site is ddos ​​or has too much traffic or not

Error on Server, in this case You can handle it yourself or contact Hosting / VPS service provider, they will support you to fix this error.

Error establishing a database connection do service mysql bị stop

The sign is "Many websites" on the same Hosting, Server with the same error Error establishing a database connection. This error has many causes, such as stopping, lack of Ram resources, CPU, bad hard drive...

Test command:

# service mysqld status

If it's red and it's stopped, try re-enabling mysql with the following command:

# service mysqld restart

# service mysqld start

Then check againstatus if it is green and mysql is "running" then the error has been fixed.

MySQL running

>>See more: Types of DDoS attacks and how to fix them

Error establishing a database connection due to poor hard disk access speed, MySQL overloaded

Database "healthy" or not depends on the speed of the hard drive is good or not. If the hard drive (HDD) is bad, the processing ability of the DB is very poor. refer to the article test VPS

=> usually this error will be accompanied by a stopped DB status, try starting and restarting as instructed above

This sign also shows You should upgrade VPS / Server to SSD instead of using HDD

Lỗi Error establishing a database connection do server / web bị ddos

This error occurs when Server, VPS or 1 domain is ddos ​​leading to overloaded database. Usually because the Server / VPS has not installed Firewall or is subjected to a large-scale DDoS attack. Bad hard drive is also the cause of this situation. If you encounter this situation, please contact your server / VPS provider for support.

Error establishing a database connection on WP due to running out of RAM, CPU, Storage space

The phenomenon can be "intermittent" or failure of the entire website

Test: run command "top c" or "htop" on SSH to test Ram and CPU. If every time Ram, CPU is high, an error appears => need to upgrade RAM, CPU.

run the command "df -h" to check the capacity, if the capacity is "100%", expand the hard drive or delete the file and the WP web will run again. DB needs to write continuously, so running out of space means DB error. This can cause a complete DB error or a File error on the Server, need to quickly delete or expand the capacity right away.

Contact Hostagy for help

If you have tried the above methods but still not working, please contact Hostagy for help. If you are using Hosting / server service at Hostingviet, then this is your right. But if you do not use the Service at Hostagy, don't worry, we will check and fix it for you. Of course, you transfer the service to Hostagy, you will have the right to request support!

Best Domain Name Provider - Hosting - VPS in Vietnam

As a unit in the top 3 in the field of website hosting services in Vietnam, Hostagy is evaluated as a provider cheap domain name and Cheap Hosting as well as always receive many recommendations from computer forums about where to buy good Hosts . From only 50,000 VND/month, users have immediately got themselves a Hosts to freely study, research or run demo websites… Besides, Hostagy is also a pioneer in cloud computing technology. (cloud Hosting), package server rental with unlimited bandwidth.
Hostagy has a variety of service packages, besides the super cheap packages of 50,000 VND/month, the provider also has cheap vps quality for many different business groups. These packages always meet the storage needs, accessing tens of thousands of people every day.
In addition, with professional customer care service, a team of highly qualified technicians will quickly support and handle arising problems. From there, helping users get a smooth and enjoyable experience.
Thus, through the article on Hostagy has helped you get more useful information! Hope you will be able to equip yourself with many more knowledge that we have shared! If you find this article useful, please subscribe to follow the latest information from Hostagy. Good luck!





Source link

hostadmin

This person is a lazy dog and has left nothing

Comments