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 : string = 'ALL PRIVILEGES'
- ALTER : string = 'ALTER'
- ALTER_ROUTINE : string = 'ALTER ROUTINE'
- CREATE : string = 'CREATE'
- CREATE_ROUTINE : string = 'CREATE ROUTINE'
- CREATE_TEMPORARY_TABLES : string = 'CREATE TEMPORARY TABLES'
- CREATE_USER : string = 'CREATE USER'
- CREATE_VIEW : string = 'CREATE VIEW'
- DELETE : string = 'DELETE'
- DROP : string = 'DROP'
- EVENT : string = 'EVENT'
- EXECUTE : string = 'EXECUTE'
- FILE : string = 'FILE'
- GRANT_OPTION : string = 'GRANT OPTION'
- INDEX : string = 'INDEX'
- INSERT : string = 'INSERT'
- LOCK_TABLES : string = 'LOCK TABLES'
- PROCESS : string = 'PROCESS'
- REFERENCES : string = 'REFERENCES'
- RELOAD : string = 'RELOAD'
- REPLICATION_CLIENT : string = 'REPLICATION CLIENT'
- REPLICATION_SLAVE : string = 'REPLICATION SLAVE'
- SELECT : string = 'SELECT'
- SHOW_DATABASES : string = 'SHOW DATABASES'
- SHOW_VIEW : string = 'SHOW VIEW'
- SHUTDOWN : string = 'SHUTDOWN'
- SUPER : string = 'SUPER'
- TRIGGER : string = 'TRIGGER'
- UPDATE : string = 'UPDATE'
- USAGE : string = 'USAGE'
- DESCRIPTIONS : array<string|int, mixed> = [self::ALL_PRIVILEGES => 'Grants all available...
- 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
string
ALTER
= 'ALTER'
ALTER_ROUTINE
public
string
ALTER_ROUTINE
= 'ALTER ROUTINE'
CREATE
public
string
CREATE
= 'CREATE'
CREATE_ROUTINE
public
string
CREATE_ROUTINE
= 'CREATE ROUTINE'
CREATE_TEMPORARY_TABLES
public
string
CREATE_TEMPORARY_TABLES
= 'CREATE TEMPORARY TABLES'
CREATE_USER
public
string
CREATE_USER
= 'CREATE USER'
CREATE_VIEW
public
string
CREATE_VIEW
= 'CREATE VIEW'
DELETE
public
string
DELETE
= 'DELETE'
DROP
public
string
DROP
= 'DROP'
EVENT
public
string
EVENT
= 'EVENT'
EXECUTE
public
string
EXECUTE
= 'EXECUTE'
FILE
public
string
FILE
= 'FILE'
GRANT_OPTION
public
string
GRANT_OPTION
= 'GRANT OPTION'
INDEX
public
string
INDEX
= 'INDEX'
INSERT
public
string
INSERT
= 'INSERT'
LOCK_TABLES
public
string
LOCK_TABLES
= 'LOCK TABLES'
PROCESS
public
string
PROCESS
= 'PROCESS'
REFERENCES
public
string
REFERENCES
= 'REFERENCES'
RELOAD
public
string
RELOAD
= 'RELOAD'
REPLICATION_CLIENT
public
string
REPLICATION_CLIENT
= 'REPLICATION CLIENT'
REPLICATION_SLAVE
public
string
REPLICATION_SLAVE
= 'REPLICATION SLAVE'
SELECT
public
string
SELECT
= 'SELECT'
SHOW_DATABASES
public
string
SHOW_DATABASES
= 'SHOW DATABASES'
SHOW_VIEW
public
string
SHOW_VIEW
= 'SHOW VIEW'
SHUTDOWN
public
string
SHUTDOWN
= 'SHUTDOWN'
SUPER
public
string
SUPER
= 'SUPER'
TRIGGER
public
string
TRIGGER
= 'TRIGGER'
UPDATE
public
string
UPDATE
= 'UPDATE'
USAGE
public
string
USAGE
= 'USAGE'
DESCRIPTIONS
Human-readable description for each MySQL privilege.
protected
array<string|int, mixed>
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.