Note
- This view is available starting with V4.3.1 in V4.3.x.
- This view is available starting with V4.2.2 in V4.2.x.
Purpose
The mysql.procs_priv view stores the privileges of stored procedures and functions.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| Host | varchar(60) | NO | The host name. |
| Db | varchar(64) | NO | The database name. |
| User | varchar(32) | NO | The username of the grantee. |
| Routine_name | varchar(64) | NO | The name of the routine. |
| Routine_type | varchar(9) | NO | The type of the routine. |
| Grantor | varchar(93) | YES | The username of the grantor. |
| Proc_priv | varchar(27) | NO | The privileges granted. |
| Timestamp | date | YES | The time when the privileges were granted. |
Sample query
Query the privileges of stored procedures and functions and display the first record.
obclient [mysql]> SELECT * FROM mysql.procs_priv LIMIT 1;
The query result is as follows:
+------+---------+------+-------------------+--------------+---------+-----------------------+------------+
| Host | Db | User | Routine_name | Routine_type | Grantor | Proc_priv | Timestamp |
+------+---------+------+-------------------+--------------+---------+-----------------------+------------+
| % | test_db | root | pro_generate_data | PROCEDURE | root@% | Execute,Alter Routine | 2023-12-21 |
+------+---------+------+-------------------+--------------+---------+-----------------------+------------+
1 row in set (0.032 sec)
References
Set whether to automatically grant the ALTER and EXECUTE privileges to the stored procedure: automatic_sp_privileges