πŸ“˜ Install MySQL Governor on CloudLinux 9 with cPanel

MySQL Governor is a powerful CloudLinux tool that monitors and limits MySQL resource usage per user. It is especially useful for shared hosting environments to prevent a single user from overloading the MySQL server.


⚠️ Prerequisites

  • Backup First: Always take a full backup of your MySQL/MariaDB databases and system tables before installing MySQL Governor. You can use mysqldump or your usual backup utility.

πŸ› οΈ Installation Steps

1. Remove Existing MySQL Governor Packages (if any)

Open your terminal and run:

yum remove db-governor db-governor-mysql -y

Note: If these packages aren’t installed, you may see errors β€” you can safely ignore them.


2. Install the MySQL Governor Package

yum install governor-mysql -y

3. Specify Your Current MySQL/MariaDB Version

Identify your installed MySQL or MariaDB version, then run the appropriate command below. Replace <VERSION> with one of the following:

  • MySQL: mysql56, mysql57, mysql80
  • MariaDB: mariadb100, mariadb101, mariadb102, mariadb103, mariadb105, mariadb106, mariadb1011
/usr/share/lve/dbgovernor/mysqlgovernor.py --mysql-version=<VERSION>

4. Install MySQL Governor

/usr/share/lve/dbgovernor/mysqlgovernor.py --install

This will complete the integration of MySQL Governor with your database engine.


βœ… Post-Installation Verification

Check the Governor Service Status

systemctl status db_governor

Look for active (running) status to confirm the installation was successful.


Monitor MySQL Usage

Run:

dbtop

This utility displays real-time MySQL resource usage per user.


Configure Per-User Resource Limits

To set CPU and read limits for a user, use:

dbctl set username --cpu=150,100,70,50 --read=2048,1500,1000,800

Replace username with the actual cPanel account name.


πŸ”„ Upgrading MySQL/MariaDB with MySQL Governor

To upgrade your MySQL/MariaDB version using MySQL Governor:

1. Set the New Version

/usr/share/lve/dbgovernor/mysqlgovernor.py --mysql-version=<NEW_VERSION>

2. Perform the Upgrade

/usr/share/lve/dbgovernor/mysqlgovernor.py --install

Important: Always back up your databases before starting an upgrade.


πŸ” Additional Resources

If you experience any issues:

  • Contact CloudLinux Support
  • Visit the cPanel Community Forums
Scroll to Top