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.

Authorizations:
query Parameters
database
required
string

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.

Example: database=cpuser_dbname
user
required
string

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.

Example: user=cpuser_dbuser
privileges
string
  • 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.
Example: privileges=DELETE,UPDATE,CREATE,ALTER

Responses

Response Schema: application/json
apiversion
integer

The version of the API.

func
string

The name of the method called.

module
string

The name of the module called.

object

Request samples

uapi --output=jsonpretty \
  --user=username \
  Mysql \
  set_privileges_on_database \
  user='cpuser_dbuser' \
  database='cpuser_dbname'

Response samples

Content type
application/json
{
  • "apiversion": 3,
  • "func": "set_privileges_on_database",
  • "module": "Mysql",
  • "result": {
    • "data": null,
    • "errors": null,
    • "messages": null,
    • "metadata": { },
    • "status": 1,
    • "warnings": null
    }
}