Syntax:
GRANT priv_type [(column_list)] [, priv_type [(column_list)]] ...
    ON [object_type] {tbl_name | * | *.* | db_name.*}
    TO user [IDENTIFIED BY [PASSWORD] 'password']
        [, user [IDENTIFIED BY [PASSWORD] 'password']] ...
    [REQUIRE
        NONE |
        [{SSL| X509}]
        [CIPHER 'cipher' [AND]]
        [ISSUER 'issuer' [AND]]
        [SUBJECT 'subject']]
    [WITH with_option [with_option] ...]

object_type =
    TABLE
  | FUNCTION
  | PROCEDURE

with_option =
    GRANT OPTION
  | MAX_QUERIES_PER_HOUR count
  | MAX_UPDATES_PER_HOUR count
  | MAX_CONNECTIONS_PER_HOUR count
  | MAX_USER_CONNECTIONS count

The GRANT statement enables system administrators to create MySQL user
accounts and to grant rights to from accounts. To use GRANT, you must
have the GRANT OPTION privilege, and you must have the privileges that
you are granting. The REVOKE statement is related and enables
administrators to remove account privileges. See [revoke].

MySQL account information is stored in the tables of the mysql
database. This database and the access control system are discussed
extensively in [database-administration], which you should consult for
additional details.

Important: Some releases of MySQL introduce changes to the structure of
the grant tables to add new privileges or features. Whenever you update
to a new version of MySQL, you should update your grant tables to make
sure that they have the current structure so that you can take
advantage of any new capabilities. See [mysql-upgrade].

If the grant tables hold privilege rows that contain mixed-case
database or table names and the lower_case_table_names system variable
is set to a non-zero value, REVOKE cannot be used to revoke these
privileges. It will be necessary to manipulate the grant tables
directly. (GRANT will not create such rows when lower_case_table_names
is set, but such rows might have been created prior to setting the
variable.)

Privileges can be granted at several levels:

o Global level

  Global privileges apply to all databases on a given server. These
  privileges are stored in the mysql.user table. GRANT ALL ON *.* and
  REVOKE ALL ON *.* grant and revoke only global privileges.

o Database level

  Database privileges apply to all objects in a given database. These
  privileges are stored in the mysql.db and mysql.host tables. GRANT
  ALL ON db_name.* and REVOKE ALL ON db_name.* grant and revoke only
  database privileges.

o Table level

  Table privileges apply to all columns in a given table. These
  privileges are stored in the mysql.tables_priv table. GRANT ALL ON
  db_name.tbl_name and REVOKE ALL ON db_name.tbl_name grant and revoke
  only table privileges.

o Column level

  Column privileges apply to single columns in a given table. These
  privileges are stored in the mysql.columns_priv table. When using
  REVOKE, you must specify the same columns that were granted.

o Routine level

  The CREATE ROUTINE, ALTER ROUTINE, EXECUTE, and GRANT privileges
  apply to stored routines (functions and procedures). They can be
  granted at the global and database levels. Also, except for CREATE
  ROUTINE, these privileges can be granted at the routine level for
  individual routines and are stored in the mysql.procs_priv table.

The object_type clause was added in MySQL 5.0.6. It should be specified
as TABLE, FUNCTION, or PROCEDURE when the following object is a table,
a stored function, or a stored procedure.
