Note
- This view was introduced in V4.3.1 of V4.3.x.
- This view was introduced in V4.2.2 of V4.2.x.
Purpose
The mysql.procs_priv view stores the privileges of stored procedure 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 user to whom the privilege is granted. |
| 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 grantor. |
| Proc_priv | varchar(27) | NO | The granted privilege. |
| Timestamp | date | YES | The grant time. |
Sample query
Query the privileges of stored procedure 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 the ALTER and EXECUTE privileges are automatically granted to stored procedures: automatic_sp_privileges