The modsecparse.pl cronjob producing the following modsecparse.pl database connection error
/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.
Solution
Try reproducing the error by running the cron job manually:
#/etc/cron.hourly/modsecparse.pl
If it shows the same error, make sure the password used on the “my $dbpassword” 19th line in /etc/cron.hourly/modsecparse.pl matches the “modsec” password in MySQL.
my $dbpassword = ‘sample’;
You can reset the “modsec” MySQL password by following these steps:
mysql > use modsec; mysql> update user set Password=password('sample') where User='modsec'; mysql > flush privileges; mysql> quit;
Also in WHM Click Service Manager -> Check enable mysql and mysql monitor boxes -> Save changes. It should solve problem.