GRANT privilege_type [(field_list)] [, privilege_type [(field_list)] ...] ON {table_name | * | *.* | database_name.*} TO user_name [IDENTIFIED BY [PASSWORD] 'password'] [, user_name [IDENTIFIED BY 'password'] ...] [REQUIRE NONE | [{SSL| X509}] [CIPHER cipher [AND]] [ISSUER issuer [AND]] [SUBJECT subject]] [WITH [GRANT OPTION | MAX_QUERIES_PER_HOUR # | MAX_UPDATES_PER_HOUR # | MAX_CONNECTIONS_PER_HOUR #]]
GRANT gives a privilege of a particular kind of permission to a user. Table A.1 describes the available privileges.
Privilege |
Description |
---|---|
ALL |
Grants all the basic permissions. |
ALL PRIVILEGES |
Same as ALL. |
ALTER |
Permission to change the structure of a table (an ALTER statement), excluding indexes. |
CREATE |
Permission to create databases and tables, excluding indexes. |
CREATE TEMPORARY TABLES |
Permission to create a temporary table. |
DELETE |
Permission to remove records from a table (a DELETE statement). |
DROP |
Permission to drop databases or tables, excluding indexes. |
EXECUTE |
Permission to run stored procedures (scheduled for MySQL 5). |
FILE |
Permission to read and write files on the server (for LOAD DATA INFILE or SELECT INTO OUTFILE statements). Any files that the mysql user can read are readable. |
INDEX |
Permission to create, modify, or drop indexes. |
INSERT |
Permission to add new records to the table (an INSERT statement). |
LOCK TABLES |
Permission to lock a table for which the user has SELECT permission. |
PROCESS |
Permission to view the current MySQL processes or kill MySQL processes (for SHOW PROCESSLIST or KILL SQL statements). |
REFERENCES |
Not currently used by MySQL and provided for ANSI SQL compatibility (it applies to the use of foreign keys). |
RELOAD |
Permission to reload the database (a FLUSH statement or a reload, refresh, or flush issued from mysqladmin). |
REPLICATION CLIENT |
Permission to ask about the replication slaves and masters. |
SHOW DATABASES |
Permission to see all databases. |
SELECT |
Permission to return data from a table (a SELECT statement). |
SHUTDOWN |
Permission to shut down the server. |
SUPER |
Permission to connect even if the maximum number of connections is reached and perform the CHANGE MASTER, KILL thread, mysqladmin debug, PURGE MASTER LOGS, and SET GLOBAL commands. |
UPDATE |
Permission to modify data in a table (an UPDATE statement). |
USAGE |
Permission to connect to the server and perform statements available to all (for early versions of MySQL 4 this included SHOW DATABASES). |