There are so many reasons for the occurrence of the problem while working with MySQL database connection. Using the details listed below we can rectify the problem. There are few things to be checked while working with the problem. The error that you may get and details to be checked is as follows:

DATABASE ERROR: CONNECTION FAILED!

Unable to connect to the database!

Please contact your server- administrator.
  • YOU HAVE TO CHECK WHETHER MySQL IS WORKING OR NOT
The command line that should be followed is:

Code:
/etc/init.d/mysql status
If MySQL is working the output should be:

Code:
# /etc/init.d/mysql status
mysqld (pid 837) is running
If it is running then you can move onto database and then to the user “roundcube”. In cPanel you can obtained the password for the database from the file “/usr/local/cpanel/base/3rdparty/roundcube
  • FROM THE COMMAND LINE CHECK FOR THE DATABASE CONNECTIVITY
Using the command line we should find whether the db user and password is working or not.

Code:
# mysql –u roundcube –p
The database which is listing under the user has to be checked, if it is working.

mysql> show databases;
-----------------------------
Database
information_schema
roundcube
-----------------------------
2 rows in set (0.09 sec)
The reason for the db error is user password. So this can be modified by changing the password.
  • YOU HAVE TO CHECK FOR THE TABLES EXISTING UNDER THE DATABASE
The database is switched to “roundcube” using the following:

Code:
mysql> use roundcube;
The tables is checked as follows

mysql> show tables;
-------------------------------
Tables_in_roundcube
cache
cache_index
cache_messages
cache_thread
contactgroupmembers
contactgroups
contacts
cp_schema_version
dictionary
identities
searches
session
system
users
----------------------------
14 rows in set (0.00 sec)
The database is repaired if the entire table exists. To repair a db follow this command

Code:
# mysqlcheck -r roundcube
The roundcube can be rebuild with the command line if the database or tables is missing. The command used to rebuild roundcube is:

Code:
/usr/local/cpanel/bin/update-roundcube --force
FYI, the force used in the command line is used to rebuild if the results are missing in the address book, signatures, etc. The other option instead of re-build option is restoration if there is a backup.
  • IF ROUNDCUBE DATABASE, USER TABLES AND PASSWORD ARE WORKING AND I HAVE SAVED THE ADDRESS BOOK AND OTHERS IN EMAIL ACCOUNTS, THEN WILL I BE ABLE TO REBUILD THE ROUNDCUBE SAFELY?
The backup of the database has to be taken in account and has to dropped before rebuilding the roundcube if all are working.

- FOR BACKING UP THE DATABASE USE THE FOLLOWING:
Code:
# mysqldump roundcube > roundcube.sql
- FOR DROPPING THE DATABASE:

Code:
DROP DATABASE roundcube;
The command above has to run in MySQL prompt

- FOR REBUILDING PURPOSE:

Code:
/usr/local/cpanel/bin/update-roundcube --force
- TO RESTORE:

Code:
# mysql roundcube < roundcube.sql
Author
Bhawani Singh
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Bhawani Singh

Top