Home >Database >Mysql Tutorial >Where are mysql stored procedures stored?
MySQL stored procedures are saved in the mysql.proc table, which stores all information about the stored procedures, including name, definition, creator, and modification time.
#Where are MySQL stored procedures stored?
Stored procedures in MySQL are stored in the mysql.proc
table of the database. This table stores information about all stored procedures created in the database.
Table structure
mysql.proc
The table contains the following columns:
db
: The name of the database to which the stored procedure belongs name
: The name of the stored procedure type
: The type of the stored procedure (PROCEDURE
or FUNCTION
) body
: The definition of the stored procedure definer
: The user and host of the creator of the stored procedure Namecreated
: The timestamp when the stored procedure was created modified
: The timestamp when the stored procedure was last modifiedsql_mode
: The SQL mode used by the stored procedure security_type
: The security type of the stored procedure (DEFINER
, INVOKER
or BOTH
)comment
: Comments on stored proceduresQuery stored procedure information
To query information about a specific stored procedure, you can use the following SQL statement:
<code class="sql">SELECT * FROM mysql.proc WHERE db = 'database_name' AND name = 'procedure_name';</code>
Modify the stored procedure definition
To modify the definition of a stored procedure, you can use the following SQL statement:
<code class="sql">ALTER PROCEDURE database_name.procedure_name [characteristic ...] body;</code>
Delete stored procedures
To delete stored procedures, you can use the following SQL statement:
<code class="sql">DROP PROCEDURE database_name.procedure_name;</code>
The above is the detailed content of Where are mysql stored procedures stored?. For more information, please follow other related articles on the PHP Chinese website!