v1

latestOpenAPI 3.0.2cPanel License2026-08-06657427.1 MB
Mysql
User Management

Update MySQL user privileges

This function sets a MySQL® database user's privileges.

Important:

When you disable the MySQL/MariaDB role, and remote MySQL is not already configured, the system disables this function.

get/Mysql/set_privileges_on_database

Query parameters

databasestring required
Example:cpuser_dbname

The database's name.

Important:

If database prefixing is enabled, you must prefix this value with the account prefix and an underscore (_). For example, for the db database on the user cPanel account, pass in a value of user_db.

userstring required
Example:cpuser_dbuser

The database user's name.

Important:

If database prefixing is enabled, you must prefix this value with the account prefix and an underscore (_). For example, for the dbuser user on the user cPanel account, pass in a value of user_dbuser.

privilegesstring
Example:DELETE,UPDATE,CREATE,ALTER
  • ALL PRIVILEGES
  • A comma-separated list of one or more of the following individual privileges:
    • ALTER
    • ALTER ROUTINE
    • CREATE
    • CREATE ROUTINE
    • CREATE TEMPORARY TABLES
    • CREATE VIEW
    • DELETE
    • DROP
    • EVENT
    • EXECUTE
    • INDEX
    • INSERT
    • LOCK TABLES
    • REFERENCES
    • SELECT
    • SHOW VIEW
    • TRIGGER
    • UPDATE

Note:

  • This list replaces, rather than adds to, the existing privilege list.
  • In browser-based and command line calls, separate multiple values with %2C and replace spaces with %20.

Response

HTTP Request was successful.

apiversioninteger

The version of the API.

funcstring

The name of the method called.

modulestring

The name of the module called.

Example response

{
  "apiversion": 3,
  "func": "set_privileges_on_database",
  "module": "Mysql",
  "result": {
    "status": 1
  }
}