cPanel – DBI connect(‘modsec:localhost’,’modsec’,…) failed: Can’t connect to local MySQL server through socket

If you have error like:

/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.

Fix:

less /etc/cron.hourly/modsecparse.pl

mysql;
use mysql;
UPDATE user SET Password=PASSWORD(‘$dbpassword’) WHERE USER=’modsec’;
flush privileges;
exit;

Leave a Reply

Your email address will not be published. Required fields are marked *