Name

GRANT

Syntax

GRANT privilege
[ (column, ...) ] [, privilege [( column, ...) ] ...]
ON {table} TO user [IDENTIFIED BY 'password']
[, user [IDENTIFIED BY 'password'] ...]
[REQUIRE [{SSL | X509}] [CIPHER cipher [AND]]
[ISSUER issuer [AND]]
[SUBJECT subject]]
[WITH [GRANT OPTION | MAX_QUERIES_PER_HOUR=limit]]

Description

Previous to MySQL 3.22.11, the GRANT statement was recognized but did nothing. In current versions, GRANT is functional. This statement enables access rights to a user (or users). Access can be granted per database, table or individual column. The table can be given as a table within the current database; use * to affect all tables within the current database, *.* to affect all tables within all databases or database.* to affect all tables within the given database.

The following privileges are currently supported:

ALL PRIVILEGES/ALL

Assigns all privileges except FILE, PROCESS, RELOAD, and SHUTDOWN

ALTER

To alter the structure of tables

CREATE

To create new tables

DELETE

To delete rows from tables

DROP

To delete entire tables

FILE

To create and remove entire databases as well as manage log files

INDEX

To create and delete indexes from tables

INSERT

To insert data into tables

PROCESS

To kill process threads

REFERENCES

Not implemented (yet)

RELOAD

To refresh various internal tables (see the FLUSH statement)

SELECT

To read data from tables

SHUTDOWN

To shut down the database server

UPDATE

To alter rows within tables

USAGE

No privileges at all

The user variable is of the ...

Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.