JIYIK CN >

Current Location:Home > Learning > DATABASE > MySQL >

List all stored procedures in MySQL

Author:JIYIK Last Updated:2025/04/22 Views:

This article introduces three ways to list all stored procedures in MySQL. They include the SHOW PROCEDURE STATUS statement, the data directory, and MySQL Workbench (a visual tool).


List all stored procedures in MySQL

We will use the data directory, MySQL Workbench, and the SHOW PROCEDURE STATUS statement to list all stored procedures in MySQL. All queries given in this article can be executed in the Windows command line once logged into the MySQL server.

We will use MySQL Workbench, a visual tool, to perform queries in this article as it displays large data in a proper tabular form for easy understanding.


Use the SHOW PROCEDURE STATUS statement to list all stored procedures in MySQL.

SHOW PROCEDURE STATUSThe basic syntax of the statement is as follows.

SHOW PROCEDURE STATUS [LIKE 'yourPattern' | WHERE searchCondition]

The following command displays all the characteristics of a stored procedure, including the database name. It also contains the procedure name, creation and modification date, description, etc.

It returns all stored procedures in the current MySQL server that we have privileges to access.

SHOW PROCEDURE STATUS;

Output:

List all stored procedures in mysql - List all procedures


Use the WHERE clause to list all stored procedures in a specific database

We can use the WHERE clause with the SHOW PROCEDURE STATUS statement to get all the stored procedures in a particular database. See the following query as an example.

SHOW PROCEDURE STATUS WHERE db = 'test';

Output:

List all stored procedures in mysql - List all stored procedures in the test database


Use the LIKE operator to list all stored procedures that contain a specific pattern

We can search for all stored procedures with a specific pattern in the procedure name. Wildcards are useful for writing patterns.

A sample query is given below.

SHOW PROCEDURE STATUS LIKE '%perform%'

Output:

List all stored procedures in mysql - use like to list all procedures


List all stored procedures in MySQL using the data directory

Another way to list all stored procedures is to query the routines table of the information_schema database. The routines table contains all the details about the stored functions and procedures of all the databases on the current MySQL server.

Here we can list all stored procedures for all databases.

SELECT  routine_name FROM information_schema.routines
WHERE routine_type = 'PROCEDURE';

Output:

List all stored procedures in mysql - Use the routines table to list all procedures in all databases

We can use the following query to list all the stored procedures for a particular database using the routines table.

SELECT routine_schema, routine_name
FROM information_schema.routines
WHERE routine_type = 'PROCEDURE'
AND routine_schema = 'test';

List all stored procedures in mysql - Use the routines table to list all procedures in the test database


List all stored procedures in MySQL using MySQL Workbench

We can click on the Stored Procedures option to list all stored procedures for each database individually.

List all stored procedures in mysql - List all procedures using workbench

For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.

Article URL:

Related Articles

Changing max_allowed_packet Size in MySQL Server

Publish Date:2025/04/22 Views:192 Category:MySQL

This article explains how to change the max_allowed_packet size in MySQL server. To understand this, we will use two operating systems, Windows 10 and Linux (Ubuntu). Changing max_allowed_packet Size in MySQL Server If we try to upload a fi

Zerofill usage, advantages and alternatives in MySQL

Publish Date:2025/04/22 Views:195 Category:MySQL

In this article we will understand the uses, advantages and alternatives of ZEROFILL attribute in MySQL. Use and benefits of the ZEROFILL attribute in MySQL The benefit of using the ZEROFILL attribute is that it has nothing to do with input

Compare only MySQL timestamp dates to date parameters

Publish Date:2025/04/22 Views:64 Category:MySQL

In this article we will use the DATE() , CAST() , and CONVERT() functions to compare MySQL timestamp dates with only the date parameter. DATE() vs. CAST() vs. CONVERT() in MySQL Below is a brief description of each function. You can also fi

Calculating Percentages in MySQL

Publish Date:2025/04/22 Views:66 Category:MySQL

We will use one or more columns to calculate percentages in MySQL. There are different ways to do this, and for each method we will use an example table. Calculate percentage using a column in MySQL We have a table called sales where ID, Re

Selecting multiple values using WHERE in MySQL

Publish Date:2025/04/22 Views:185 Category:MySQL

This article is about using MySQL query to get data from a specific table or relation that satisfies a specific condition. To do this, the WHERE clause is used in the SQL query. WHERE clause in SQL query WHERE The clause specifies the condi

Changing the connection timeout in MySQL

Publish Date:2025/04/22 Views:59 Category:MySQL

We are learning how to change the connection timeout in MySQL using Linux (Ubuntu 20.04) and Windows operating systems. Changing the connection timeout in MySQL Sometimes you keep losing connection to the MySQL server because the connect_ti

MySQL fix Data Is Truncated for a Column error

Publish Date:2025/04/22 Views:101 Category:MySQL

This article describes possible causes and solutions for the MySQL error Data is truncated for a column . Fix data truncated due to column error in MySQL Here, we will discuss the possible causes and solutions to eliminate MySQL data trunca

MySQL Error Server PID File Could Not Be Found Solution

Publish Date:2025/04/22 Views:192 Category:MySQL

In this article, we will study about the Error! Error Server PID File Could Not Be Found! in MySQL and its solution with full explanation. MySQL PID file The file that contains the process identification number or process ID of a running My

Get the last inserted ID using PHP MySQLi function

Publish Date:2025/04/22 Views:99 Category:MySQL

This article briefly introduces the PHP mysqli() function and demonstrates how to use it to get the last inserted ID from a MySQL database. PHP mysqli() Function It is an extended version of the MySQL driver called mysqli and is typically u

Scan to Read All Tech Tutorials

Social Media
  • https://www.github.com/onmpw
  • qq:1244347461

Recommended

Tags

Scan the Code
Easier Access Tutorial