Database connection error in Email piping

Issue: Sometimes when you connect MySQL through Jailshell to setup email piping, you get the following error in mail header:

Error: Could not connect to the database

Fix: There may be more than one reason to occur this issue. You need to check following things to troubleshoot:

1. From the email header we can see the error "Could not connect to the database" and you need to check if "/var/tmp/mysql.sock" symlink is missing in the server.

# ll /var/tmp/mysql.sock
lrwxrwxrwx 1 mysql mysql 25 Apr 29 20:30 /var/tmp/mysql.sock -> /var/lib/mysql/mysql.sock=

The above result is showing that symlink is present. If not, create one using the following command:

# ln -s  /var/tmp/mysql.sock /var/lib/mysql/mysql.sock=

2. Cpanel jailshell access to mysql requires the use of "127.0.0.1" specifically instead of "localhost", and since the WHMCS autoresponder pipe script access mysql, the configuration.php file needed to be updated to change "localhost" to "127.0.0.1".
You can fix the mysql connection issues in the jailed shell access by adding the -h127.0.0.1 while connecting to mysql from jailshell . You can connect to the mysql user from your jailed shell access using the following command without any issues. 'mysql -u <database_name> -p -h 127.0.0.1'

The issue should have fixed using the above steps. Cheers :)

Comments

Popular posts from this blog

SVN: File remains in conflict

HowTo: Enable extended logging for exim

12 tweakings for WHM/cPanel to speed up WordPress