Home  >  Article  >  Database  >  Where are mysql stored procedures stored?

Where are mysql stored procedures stored?

下次还敢
下次还敢Original
2024-04-22 19:03:34727browse

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?

#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 Name
  • created: The timestamp when the stored procedure was created
  • modified: The timestamp when the stored procedure was last modified
  • sql_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 procedures

Query 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn