MysqlPrivileges uses ConstantsTrait
MySQL Privilege Constants.
This class provides an enumeration of all MySQL privilege keywords, as defined in the official MySQL documentation. It also includes human-readable descriptions for each privilege.
These constants represent privilege names that can be used in GRANT, REVOKE, and privilege checking statements. This list is based on MySQL 8.x and covers both global and object-level permissions.
Use with ConstantsTrait to retrieve available privileges dynamically.
Tags
Table of Contents
Constants
- ALL_PRIVILEGES = 'ALL PRIVILEGES'
- ALTER = 'ALTER'
- ALTER_ROUTINE = 'ALTER ROUTINE'
- CREATE = 'CREATE'
- CREATE_ROUTINE = 'CREATE ROUTINE'
- CREATE_TEMPORARY_TABLES = 'CREATE TEMPORARY TABLES'
- CREATE_USER = 'CREATE USER'
- CREATE_VIEW = 'CREATE VIEW'
- DELETE = 'DELETE'
- DROP = 'DROP'
- EVENT = 'EVENT'
- EXECUTE = 'EXECUTE'
- FILE = 'FILE'
- GRANT_OPTION = 'GRANT OPTION'
- INDEX = 'INDEX'
- INSERT = 'INSERT'
- LOCK_TABLES = 'LOCK TABLES'
- PROCESS = 'PROCESS'
- REFERENCES = 'REFERENCES'
- RELOAD = 'RELOAD'
- REPLICATION_CLIENT = 'REPLICATION CLIENT'
- REPLICATION_SLAVE = 'REPLICATION SLAVE'
- SELECT = 'SELECT'
- SHOW_DATABASES = 'SHOW DATABASES'
- SHOW_VIEW = 'SHOW VIEW'
- SHUTDOWN = 'SHUTDOWN'
- SUPER = 'SUPER'
- TRIGGER = 'TRIGGER'
- UPDATE = 'UPDATE'
- USAGE = 'USAGE'
- DESCRIPTIONS = [self::ALL_PRIVILEGES => 'Grants all available privileges.', self::SELECT => 'Allows reading data using SELECT.', self::INSERT => 'Allows inserting data into tables.', self::UPDATE => 'Allows updating existing rows.', self::DELETE => 'Allows deleting rows from tables.', self::CREATE => 'Allows creation of new databases and tables.', self::DROP => 'Allows deletion of databases and tables.', self::ALTER => 'Allows modifying table structure.', self::INDEX => 'Allows creating and dropping indexes.', self::TRIGGER => 'Allows creating and dropping triggers.', self::REFERENCES => 'Allows defining foreign keys.', self::LOCK_TABLES => 'Allows locking tables for access control.', self::CREATE_TEMPORARY_TABLES => 'Allows creating temporary tables.', self::CREATE_VIEW => 'Allows creating views.', self::SHOW_VIEW => 'Allows viewing definitions of views.', self::CREATE_ROUTINE => 'Allows creating stored procedures and functions.', self::ALTER_ROUTINE => 'Allows modifying or dropping routines.', self::EXECUTE => 'Allows executing stored routines.', self::EVENT => 'Allows creating, altering, dropping events.', self::FILE => 'Allows reading/writing files on the server.', self::PROCESS => 'Allows viewing threads from all users.', self::RELOAD => 'Allows reloading server configuration.', self::SHUTDOWN => 'Allows shutting down the server.', self::SUPER => 'Grants various powerful administrative privileges.', self::SHOW_DATABASES => 'Allows seeing all databases.', self::CREATE_USER => 'Allows creating, renaming and dropping users.', self::GRANT_OPTION => 'Allows granting privileges to other users.', self::REPLICATION_CLIENT => 'Allows querying replication status.', self::REPLICATION_SLAVE => 'Allows replication slaves to connect.', self::USAGE => 'Minimal privilege: allows connection only.']
- Human-readable description for each MySQL privilege.
Methods
- allDescriptions() : array<string, string>
- Get all privileges with their description.
- describe() : string|null
- Get a human-readable description for a given privilege.
Constants
ALL_PRIVILEGES
public
string
ALL_PRIVILEGES
= 'ALL PRIVILEGES'
Global privilege granting all other privileges.
ALTER
public
mixed
ALTER
= 'ALTER'
ALTER_ROUTINE
public
mixed
ALTER_ROUTINE
= 'ALTER ROUTINE'
CREATE
public
mixed
CREATE
= 'CREATE'
CREATE_ROUTINE
public
mixed
CREATE_ROUTINE
= 'CREATE ROUTINE'
CREATE_TEMPORARY_TABLES
public
mixed
CREATE_TEMPORARY_TABLES
= 'CREATE TEMPORARY TABLES'
CREATE_USER
public
mixed
CREATE_USER
= 'CREATE USER'
CREATE_VIEW
public
mixed
CREATE_VIEW
= 'CREATE VIEW'
DELETE
public
mixed
DELETE
= 'DELETE'
DROP
public
mixed
DROP
= 'DROP'
EVENT
public
mixed
EVENT
= 'EVENT'
EXECUTE
public
mixed
EXECUTE
= 'EXECUTE'
FILE
public
mixed
FILE
= 'FILE'
GRANT_OPTION
public
mixed
GRANT_OPTION
= 'GRANT OPTION'
INDEX
public
mixed
INDEX
= 'INDEX'
INSERT
public
mixed
INSERT
= 'INSERT'
LOCK_TABLES
public
mixed
LOCK_TABLES
= 'LOCK TABLES'
PROCESS
public
mixed
PROCESS
= 'PROCESS'
REFERENCES
public
mixed
REFERENCES
= 'REFERENCES'
RELOAD
public
mixed
RELOAD
= 'RELOAD'
REPLICATION_CLIENT
public
mixed
REPLICATION_CLIENT
= 'REPLICATION CLIENT'
REPLICATION_SLAVE
public
mixed
REPLICATION_SLAVE
= 'REPLICATION SLAVE'
SELECT
public
mixed
SELECT
= 'SELECT'
SHOW_DATABASES
public
mixed
SHOW_DATABASES
= 'SHOW DATABASES'
SHOW_VIEW
public
mixed
SHOW_VIEW
= 'SHOW VIEW'
SHUTDOWN
public
mixed
SHUTDOWN
= 'SHUTDOWN'
SUPER
public
mixed
SUPER
= 'SUPER'
TRIGGER
public
mixed
TRIGGER
= 'TRIGGER'
UPDATE
public
mixed
UPDATE
= 'UPDATE'
USAGE
public
mixed
USAGE
= 'USAGE'
DESCRIPTIONS
Human-readable description for each MySQL privilege.
protected
array<string, string>
DESCRIPTIONS
= [self::ALL_PRIVILEGES => 'Grants all available privileges.', self::SELECT => 'Allows reading data using SELECT.', self::INSERT => 'Allows inserting data into tables.', self::UPDATE => 'Allows updating existing rows.', self::DELETE => 'Allows deleting rows from tables.', self::CREATE => 'Allows creation of new databases and tables.', self::DROP => 'Allows deletion of databases and tables.', self::ALTER => 'Allows modifying table structure.', self::INDEX => 'Allows creating and dropping indexes.', self::TRIGGER => 'Allows creating and dropping triggers.', self::REFERENCES => 'Allows defining foreign keys.', self::LOCK_TABLES => 'Allows locking tables for access control.', self::CREATE_TEMPORARY_TABLES => 'Allows creating temporary tables.', self::CREATE_VIEW => 'Allows creating views.', self::SHOW_VIEW => 'Allows viewing definitions of views.', self::CREATE_ROUTINE => 'Allows creating stored procedures and functions.', self::ALTER_ROUTINE => 'Allows modifying or dropping routines.', self::EXECUTE => 'Allows executing stored routines.', self::EVENT => 'Allows creating, altering, dropping events.', self::FILE => 'Allows reading/writing files on the server.', self::PROCESS => 'Allows viewing threads from all users.', self::RELOAD => 'Allows reloading server configuration.', self::SHUTDOWN => 'Allows shutting down the server.', self::SUPER => 'Grants various powerful administrative privileges.', self::SHOW_DATABASES => 'Allows seeing all databases.', self::CREATE_USER => 'Allows creating, renaming and dropping users.', self::GRANT_OPTION => 'Allows granting privileges to other users.', self::REPLICATION_CLIENT => 'Allows querying replication status.', self::REPLICATION_SLAVE => 'Allows replication slaves to connect.', self::USAGE => 'Minimal privilege: allows connection only.']
Methods
allDescriptions()
Get all privileges with their description.
public
static allDescriptions() : array<string, string>
Return values
array<string, string> —Array of privilege => description.
describe()
Get a human-readable description for a given privilege.
public
static describe(string $privilege) : string|null
Parameters
- $privilege : string
-
One of the MysqlPrivileges::* constants.
Return values
string|null —Description of the privilege, or null if not defined.