The cPanel MySQL Databases page shows a tidy grid of privilege checkboxes — SELECT, INSERT, UPDATE, DELETE, and so on. What it doesn’t show is that some grants applications request (LOCK TABLES, EVENT, TRIGGER, REFERENCES) are not in the UI vocabulary on older cPanel builds, that ALL PRIVILEGES in the UI is not the same as GRANT ALL in MySQL, and that the host field is invisibly fixed to localhost. Applications that need a single grant like RELOAD or that connect from a remote IP fail at install time and the message is rarely useful.
What’s happening
cPanel writes grants through cpsrvd into a database map (/var/cpanel/databases/users.db.cache) and then issues the corresponding GRANT statement to MySQL. The map is the source of truth for what cPanel believes the account owns; the MySQL grant tables are the runtime. When they drift — usually because someone ran GRANT directly via root mysql — cPanel will silently overwrite your manual grants the next time the user edits the database through the UI. Anything you do as root that touches acmecorp_% users without going through uapi or whmapi1 is a manual change that cPanel does not track.
How to verify
whmapi1 list_users
uapi --user=acmecorp Mysql list_users
mysql -e "SHOW GRANTS FOR 'acmecorp_app'@'localhost'"
mysql -e "SELECT User, Host FROM mysql.user WHERE User='acmecorp_app'"
uapi shows cPanel’s view; SHOW GRANTS shows MySQL’s view. If the application is failing on a statement and SHOW GRANTS lists ALL PRIVILEGES ON acmecorp_app.*, the missing piece is not a privilege — it’s usually that the application expects acmecorp_app@% and cPanel only created acmecorp_app@localhost. Remote MySQL is a separate concern, covered in its own article.
The fix
- Use the API for any non-trivial grant:
uapi --user=acmecorp Mysql set_privileges_on_database user=acmecorp_app database=acmecorp_app privileges=ALLissuesGRANT ALLon the right schema. The shorthandprivileges=ALLmaps to the full MySQL vocabulary including TRIGGER, EVENT, and LOCK TABLES — the UI checkbox does not on cPanel installs older than v110. - For per-statement grants, write the named list:
privileges=SELECT,INSERT,UPDATE,DELETE,EXECUTE. cPanel will refuse anything not in its allowlist (noSUPER, noRELOAD, noPROCESS). If the application genuinely needs one of those, the application is doing something it should not be doing on a shared cPanel host — escalate, do not grant. - Never run raw GRANT as root against an
acmecorp_%user. Usewhmapi1from root:whmapi1 modify_user_privileges user=acmecorp dbuser=acmecorp_app dbname=acmecorp_app privileges=ALL. This writes to both the cPanel map and MySQL, atomically. - After any direct mysql touch, run
/usr/local/cpanel/bin/dbmaprepair --dbmap-clobberto rebuild the map from the live MySQL grants. Without it, the next UI edit will revert your work.
When grant drift is suspected across many accounts, Stack Harbor’s cPanel server management team runs the dbmap audit and reconciles the two views before they cause a 3am support call.