Tag Archives: mod_security plugin error

The mod_security plugin could not connect to the database: cPanel

If you have been getting the error “The mod_security plugin could not connect to the  database”

Below are the steps to rectify it

SSH to server

Check the password set for modsec database using below command,

In my case below was the password

root@vps [~]# grep “dbpassword” /etc/cron.hourly/modsecparse.pl

my $dbpassword = ‘qS_lqkU5mXkA’;
my $dbh  = DBI->connect( “DBI:mysql:$dbname:$dbhost”, $dbuser, $dbpassword )

The password set in my case as  qS_lqkU5mXkA

Now login into mysql and use below steps

root@vps [~]# mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1569
Server version: 5.5.36-cll MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> UPDATE user SET Password=PASSWORD(‘qS_lqkU5mXkA’) WHERE USER=’modsec’;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit

Login to WHM >> Plugin > Mod_security

You should be able to see working Mod_security