Description
This function grants permissions to a MySQL® database user.
Warning:
- UAPI (recommended) —
Mysql::set_privileges_on_database
— This function sets a MySQL® database user's privileges. - cPanel API 2 —
MysqlFE::setdbuserprivileges
— This function grants privileges to a user on a database.
Examples
Parameters
Parameter |
Type |
Description |
Possible values |
Example |
dbname |
string |
Required The MySQL database name. |
A valid MySQL database.
Important: To learn more about database username limits, click your database type to expand the following: MySQL MySQL limits the database username to 16 characters. The system includes the database prefix (the first eight characters of the cPanel account's username and an underscore character) in the character count for the username. For example:
MariaDB MariaDB limits the database username to 47 characters. The system includes the database prefix (all of the cPanel account's username and an underscore character) in the character count for the username. For example:
|
database |
username |
string |
Required The MySQL user's name. |
A valid MySQL user. |
user |
perms_list |
string |
Required The permissions to grant to the MySQL user. |
Use any of the following values in a space-delimited list:
|
alter lock create |
Returns
This function does not return output.