The most common cause of "error establishing a database connection" in WordPress is your server running out of memory. When the server runs out of memory, MySQL will crash. The best solution is to upgrade to a server with more memory.
In addition to increasing your server's memory, you may want to reduce your WordPress site's memory usage.
You can confirm that your server is running out of memory by looking for the message "Out of memory" in the log file /var/log/syslog.
Another cause of "error establishing a database connection" is a full disk. You should check your server's disk space. If it is full, then you should either upgrade to a larger size or carefully delete unnecessary files.
Another common cause of "error establishing a database connection" is database password may be wrong. To fix this, go to filmanager tab and login to your server using the given credentials from the filemanager tab. Once you access your remote files in your server, find wp-config.php in the public folder and click the 3 dots edit button once you choose wp-config.php file. Find the database password line in the wp-config.php file and then head over to Database tab in your Apps section in your panel and change password. Copy the new password and replace it in the wp-config.php file. Click save button. Then refresh your site url in your browser and if all ok, your site page will appear.
If you have verified that your server is not running out of memory or disk space, you may have incorrect database credentials in your WordPress app's wp-config.php file. You should confirm that the database information in that file is correct.
Alert: For Control Panel Help & Tutorials, click here: Panel Tutorials