Showing Database Error CONNECTION FAILED under webmail


Each hosting account enables you to build one or more personalized email accounts. The permitted number of accounts is displayed in the left menu of cPanel's home page (along with other information and statistics). An Email Account performs as a virtual address for Email Messages. It's provided by your Email Account provider or Internet Service Provider. It contains details regarding your Username, Email Account provider, Email Settings and password.

In this page, we will discuss how to resolve the error Showing Database Error CONNECTION FAILED in your webmail. Almost all the technical aspects that possess different functionalities on the server are fed with the database wherein the useful transmission of the data takes place. When the server fails to connect to the database there arrives the possible error called database error connection failed. This is true even with the webmail. .Before discussing this issue let us quickly understand What is Webmail and What is Roundcube.

Webmail is an email system through which the users access their emails through the browser on any device, computer that is connected to the Internet. Webmail allows the users to access their emails until they have access to a browser and net connection. It is basically a web-based email account that allows the users to access emails.

Roundcube is a multilingual IMAP client which is web-based with an application-like user interface. Roundcube is a free and open-source software where clients log in and view, send and reply to emails. It has a smooth and easy to use interface with you can easily access your emails. To login into email account with any interface( like horde or RoundCube) using domain_name/webmail, example exampledomain.com/webmail.

What is the Issue?

While visiting this URL For example http://100.00.00.123/etc/app/webmail under HostingRaja VPS or Cloud server it is  showing database error CONNECTION FAILED!.

 

You need to make sure that your server status is active or not and also the database status  then please proceed to next step which we have mentioned below.


database-error

Why has this issue occurred?


The issue is due to a database named  sentora_roundcube and table named vacation under sentora_postfix database has been corrupted. These two databases are related to HostingRaja Mail server Database, below is the reason why the database will be Corruption due, it is as follows:

a) Improper shutdown of mysql server due to the power outage.

b) Using “killall -9 mysqld” command to shutdown the server and killing all the ongoing mysql processes.

c) Mysqld Services got stopped due to high load in the server or RAM usage exceeded its limit.

d) Having a large amount of data’s in your database. You should make sure that there is enough disk space to store the data in advance

e) when the MySQL Roundcube user is absent 

f.)Mysql Roundcube user has an invalid password

g.) when the mysql user does not have sufficient/required permissions

 

database-error


Note :

You need to make sure that your server status is active or not and also the database status then please proceed to the next step which we have mentioned below.

How can we prevent it?

Steps to be followed to resolve this kind of issue:


1. Checking error log is a good practice which will resolve your problem very quickly.You will get  the root cause of the issue by using the command:

tail -f /var/sentora/logs/roundcube/errors


2.Now check whether the database is corrupted or not using the command:

mysqlcheck --databases sentora_roundcube


mysqlcheck --databases sentora_postfix


3. If you found database is corrupted check for the available backup of a particular database and download it to your local system:


Database backup will be available under the path:


/backup/mysql/127.0.0.1/sentora_postfix/

/backup/mysql/127.0.0.1/sentora_roundcube/


Enter this command in your local terminal to download the backup,

Example:

rsync -avzhe ssh --progress This email address is being protected from spambots. You need JavaScript enabled to view it.:/root/alldb.sql  /home/comp1/Desktop/


while deleting the table if you get this error:  MySQL Cannot drop index needed in a foreign key constraint.

means you need to drop the primary table of which foreign key is present in the table.

Ex: If the primary table is users, which is having a foreign key in the cache table first you need to drop users table and create users table(Create table details of the particular table is found on downloaded file). Then you need to drop the cache table.This process needs to be followed wherever you get this kind of error.


5. Once database related things is completed/finished you need to check for postfix, roundcube, mysql root, proftpd passwords are working fine or not using the below commands:


cat passwords.txt


mysql -u proftpd -p


mysql -u roundcube -p


mysql -u postfix -p


If it is not working then you need to update latest passwords.The password details will be sent to your registered email ID while your account got created or else you can contact our support team for the same.


6. Next, you need to go the below path:

cd /etc/sentora/configs/postfix/

ls -ll

check for the password present inside this files is correct or not.

mysql-relay_domains_maps.cf

mysql-virtual_alias_maps.cf

mysql-virtual_domains_maps.cf

mysql-virtual_mailbox_limit_maps.cf

mysql-virtual_mailbox_maps.cf

vacation.conf


if the wrong password is present kindly update the new password.


Step 7: Restart httpd, varnish, postfix, dovecot, SpamAssassin:

             Step 7.1: Restart httpd using the command

                             service httpd restart

             Step 7.2: Restart varnish using the command

                            service varnish restart

             Step 7.3: Restart postfix using the command

                            service postfix restart

             Step 7.4: Restart dovecot using the command

                            service dovecot restart

             Step 7.5: Restart SpamAssassin using the command

                            service spamassassin restart


After you are done with it, you will be able to login to a webmail account and send emails to the recipients.

The following details help you to save your database corruption on the HostingRaja VPS or Cloud Server:


  1. Take the backup of mysql databases on daily basis along with checking the mysql status.

  2. Don't maintain more load on the server by uploading unwanted files and folders, plugins installation and so on. Build your site quite simple and lightweight with out any fatal code level error.

  3. Don’t do complex queries executions and never maintain large data’s in the database. Optimize mysql queries and build proper table structure.

  4. Its very important that never delete or edit any files or folder in HostingRaja Server without knowing its purpose.

 

Almost all the technical aspects that possess different functionalities on the server are fed with the database wherein the useful transmission of the data takes place. When the server fails to connect to the database there arrives the possible error called database error connection failed. This is true even with the web mail. How to deal with the same is elaborated below.

If you need any assistance, feel free to contact our technical team members as they are available 24/7 via phone call, email, ticket system or call out toll-free no 1800-123-8642.