Same problem here.
Notice that it started when Mysql updated to V5.1.73 according to the timestamp on /var/lib/mysql/mysql_upgrade_info (and assuming it was updated at that time as the contents of the file are simply 5.1.73 )
I have verified that I can connect to the database as the user.
The error message states that the modsecparse.pl script is trying to connect to the socket at /tmp/mysql.sock, but the location of the socket is /var/lib/mysql/mysql.sock
Personally, I hate changing any cpanel script to get around this (or any other cpanel issues) as the next cpanel update might simply over-write it and I would be back to fixing it again.
For those that don't want to wait the hack is actually trivial - on line 13 - comment it out and force it to use the socket at the correct location.
Code:
# my $dbhost = 'localhost';
my $dbhost = 'mysql_socket=/var/lib/mysql/mysql.sock';
Ideally, the script SHOULD, rather than use a localhost connection, is to determine the actual location of the socket file, then set the value.
But at least for now, until this script is updated, I will stop getting these annoying cron job messages.
Output before modification
Code:
[email protected] [/]# /etc/cron.hourly/modsecparse.pl
DBI connect('modsec:localhost','modsec',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at /etc/cron.hourly/modsecparse.pl line 19
Unable to connect to mysql database at /etc/cron.hourly/modsecparse.pl line 19.
[email protected] [/]#
Output AFTER modification