Valid for versions 82 through the latest version
Last modified: May 13, 2020
Overview
The /usr/local/cpanel/scripts/securemysql script secures a cPanel accounts MySQL® configuration. To do this, the script performs the following actions:
-
Confirms that MySQLs
rootpassword exists. -
Changes the
var/db/mysqlandvar/lib/mysqldirectories ownership to themysqluser. -
Removes the
anonymousand remoterootusers. -
Removes the test database.
-
Removes the databases
LOCK TABLESandTMP TABLESprivileges.
To undo any changes that this script performs, create the /etc/securemysqldisable touch file.
Run the script
To use this script, run the following command as the root user:
/usr/local/cpanel/scripts/securemysql [arguments] [actions]
Arguments
The /usr/local/cpanel/scripts/securemysql script accepts the following arguments:
-
-aSpecify additional actions in a comma-separated list. For example:-a removeanon, removeremoterootFor a list of additional actions, view the Actions section below.Note:To perform all actions on a MySQL database, pass the
-aargument without any additional actions. -
-FExecute the script and do not display the help text. -
-hDisplay the help message. -
-qExecute the script in silent mode.
Actions
You can specify any of the following options in a comma-separated list with the -a argument:
-
removeanonRemove any anonymous MySQL users. -
removetestdbRemove test database. -
removelockntmpRemove globalLOCK TABLESpermissions and createTMP TABLESprivileges. -
removeremoterootRemove remoterootuser login privileges. -
removehordeallhostsRemove insecure Horde login credentials and privileges.Note:As of cPanel & WHM version 11.50, cPanel & WHM uses SQLite databases to store MySQL user data instead of Horde databases.
-
removehordeblankpassRemove Horde database users that possess blank login passwords.Note:As of cPanel & WHM version 11.50, cPanel & WHM uses SQLite databases to store MySQL user data instead of Horde databases.

