Latest news from 5wire Networks

Database Connection Problems – User modsec /etc/cron.hourly/modsecparse.pl on cPanel

Database connection problems with modsecparse.pl are usually caused by an issue with mod_security. You will receive an email an hour such as the below, informing you that there is a problem with the service.

/etc/cron.hourly/modsecparse.pl:  DBI connect('modsec:93.1.2.144','modsec',...) failed: Access denied for user 'modsec'@'localhost' (using password: YES) at /etc/cron.hourly/modsecparse.pl line 20 Unable to connect to mysql database at /etc/cron.hourly/modsecparse.pl line 20.

The resolution to enable connectivity is straight forward. To double check there is an issue with connectivity, in SSH type –

/etc/cron.hourly/modsecparse.pl

If it is working, it won’t throw out any error….. If not, you will see a DBI connect failure message. What we need to do this, grab the password for the service from /etc/cron.hourly/modsecparse.pl.

nano /etc/cron.hourly/modsecparse.pl

You will see the dbpassword line with the password, copy this into a local text document –

my $dbpassword = 'r7asda2YPnPJ1';

Now you will need to load up mysql, in SSH type

mysql mysql

We then update the password for user modsec with the password we collected from the modsecparse.pl file

mysql > update user set Password=password('r7asda2YPnPJ1') where User='modsec';

Flush the privileges

mysql > flush privileges;

And all done!

mysql > quit; To check modsecparse is now running, type the below into the command line

/etc/cron.hourly/modsecparse.pl If no errors show, modsecparse is back up and running again!

25% DISCOUNT FOR LIFE

Life time discount when you purchase your first order. Applies to Web Hosting, Reseller Hosting, and Cloud Servers.

Free Domain included on yearly Web Hosting plans.

Use code WEBOFF at the checkout!

Terms and Conditions apply. Voucher code is only valid for new customers.