Name

GRANT

Synopsis

GRANT privilege [ (column, ...) ] [, privilege [( column, ...) ] ...]
    ON {table} TO user [IDENTIFIED BY ‘password']
        [, user [IDENTIFIED BY ‘password'] ...] [WITH GRANT OPTION]

Previous to MySQL 3.22.11, the GRANT statement was recognized but did nothing. In current versions, GRANT is functional. This statement will enable 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, `*' to affect all tables within the current database, `*.*' to affect all tables within all databases or `database.*' to effect all tables within the given database.

The following privileges are currently supported:

ALL PRIVILEDGES/ALL

Effects all privileges

ALTER

Altering the structure of tables

CREATE

Creating new tables

DELETE

Deleting rows from tables

DROP

Deleting entire tables

FILE

Creating and removing entire databases as well as managing log files

INDEX

Creating and deleting indices from tables

INSERT

Inserting data into tables

PROCESS

Killing process threads

REFERENCES

Not implemented (yet)

RELOAD

Refreshing various internal tables (see the FLUSH statement)

SELECT

Reading data from tables

SHUTDOWN

Shutting down the database server

UPDATE

Altering rows within tables

USAGE

No privileges at all

The user variable is of the form user@hostname. Either the user or the hostname can contain SQL wildcards. If wildcards are used, either the whole name must be quoted, or just the part(s) with the wildcards (e.g., ...

Get MySQL and mSQL 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.