GRANT SELECT, INSERT ON mydb.mytbl TO ’someuser’@’somehost’; 

If you specify tbl_name  rather than db_name.tbl_name , the statement applies to tbl_name  in the default database. An error occurs if there is no default database. 

The permissible priv_type  values at the table level are ALTER , CREATE VIEW , CREATE , DELETE , DROP , GRANT OPTION , INDEX , INSERT , REFERENCES , SELECT , SHOW VIEW , TRIGGER , and UPDATE . 

Table-level privileges apply to base tables and views. They do not apply to tables created with CREATE TEMPORARY TABLE , even if the table names match. For information about TEMPORARY  table privileges, see Section 13.1.20.2, “CREATE TEMPORARY TABLE Statement” . 

## Column Privileges 

MySQL stores table privileges in the mysql.tables_priv  system table. 

Column privileges apply to single columns in a given table. Each privilege to be granted at the column level must be followed by the column or columns, enclosed within parentheses. 

GRANT SELECT (col1), INSERT (col1, col2) ON mydb.mytbl TO ’someuser’@’somehost’; 

The permissible priv_type  values for a column (that is, when you use a column_list  clause) are INSERT , REFERENCES , SELECT , and UPDATE . 

## Stored Routine Privileges 

MySQL stores column privileges in the mysql.columns_priv  system table. 

The ALTER ROUTINE , CREATE ROUTINE , EXECUTE , and GRANT OPTION  privileges apply to stored routines (procedures and functions). They can be granted at the global and database levels. Except for CREATE ROUTINE , these privileges can be granted at the routine level for individual routines. 

GRANT CREATE ROUTINE ON mydb.* TO ’someuser’@’somehost’; GRANT EXECUTE ON PROCEDURE mydb.myproc TO ’someuser’@’somehost’; 

The permissible priv_type  values at the routine level are ALTER ROUTINE , EXECUTE , and GRANT OPTION . CREATE ROUTINE  is not a routine-level privilege because you must have the privilege at the global or database level to create a routine in the first place. 

## Proxy User Privileges 

MySQL stores routine-level privileges in the mysql.procs_priv  system table. 

The PROXY  privilege enables one user to be a proxy for another. The proxy user impersonates or takes the identity of the proxied user; that is, it assumes the privileges of the proxied user. 

GRANT PROXY ON ’localuser’@’localhost’ TO ’externaluser’@’somehost’; 

When PROXY  is granted, it must be the only privilege named in the GRANT  statement, and the only permitted WITH  option is WITH GRANT OPTION . 

Proxying requires that the proxy user authenticate through a plugin that returns the name of the proxied user to the server when the proxy user connects, and that the proxy user have the PROXY  privilege for the proxied user. For details and examples, see Section 6.2.18, “Proxy Users” . 

MySQL stores proxy privileges in the mysql.proxies_priv  system table. 

