How do I view my stored procedures in phpMyAdmin?

MysqlSqlStored ProceduresPhpmyadmin

Mysql Problem Overview


I created a stored procedure in phpMyAdmin

CREATE PROCEDURE Sample()
SELECT * FROM feedback

Where could I view this this procedure? If it's not possible in phpMyAdmin, what is/are some good program(s) that have the feature to write, store, and view stored procedures, tables, etc?

Mysql Solutions


Solution 1 - Mysql

View stored procedures in phpmyadmin:

Query:

SELECT routine_definition
FROM information_schema.routines
WHERE 
routine_name = 'procedure_name' AND routine_schema = 'databasename';

Here's how to get there in phpmyadmin.

phpmyadmin screenshot

The routines option is available in phpmyadmin. The link is not visible in PHPmyadmin until you have at least one stored procedure. See the above image and click the routines link under structure tab.

Solution 2 - Mysql

select routine_definition
from information_schema.routines
where routine_schema = 'db_name'
and routine_name = 'sp_name';

Solution 3 - Mysql

This answer shows how to view them without a script.

"Once you created the stored procedure it will appear in the Routines fieldset below your tables (in the Structure tab), and you can easily change/drop it."

Solution 4 - Mysql

In short you can use this sql

SHOW CREATE PROCEDURE Sample;

More information here

UPDATE: If you don't remember the names, you can query the INFORMATION_SCHEMA database to see all the procedures (well you can use a LIKE on ROUTINE_NAME, if you remember a partial name)

SELECT ROUTINE_TYPE, ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='dbname';

Solution 5 - Mysql

You can select "information_schema" as database and query all entries form the table "routines", in case u don't want to use SQL everytime.

Solution 6 - Mysql

under phpMyAdmin, click on your database (Not on the table), then click on "+Routines".

There you can edit/drop all your stored procedures

Solution 7 - Mysql

show procedure status; 		-- will show you the stored procedures.
show create procedure MY_PROC; 	-- will show you the definition of a procedure. 
help show;			-- show all the available options for the show command.

Solution 8 - Mysql

In PHPMYADMIN enter image description here3.5.2.2 version you just click on routines link in top. See the attached image

Solution 9 - Mysql

Don't forget that in smaller screens you'll have to use the "more" menu. phpMyAdmin

Solution 10 - Mysql

After clicking home, databases, the database I created the procedure in. It opens the structure window of that database. In the menu bar: "structure, sql, search ,..." there should be routines, if it's not then click on the right item called more and it should be there (curse my netbook for not having a 24 inch screen).

To make sure your database has the procedure click on export, choose "Custom - display all possible options", under "Output:" choose "View output as text", under "Format-specific options:" choose "structure" (just under "dump table"),make sure "Add CREATE PROCEDURE / FUNCTION / EVENT statement" is selected (just a little under "dump table"). Now click Go and your procedure should show up

using: Version information: 3.5.2, latest stable version: 3.5.2.2

Solution 11 - Mysql

Use the [Adminer data-base interface][1]. Unlike PHPMyAdmin, it's perfectly able to view, edit and invoke stored procedures, where PHPMyAdmin fails with tons of errors (errors when you try to run an SQL statement to create one, errors when you try to invoke one, errors when you try to alter one already created, beside of its inability to list the ones defined… I really wonder what PHPMyAdmin do with with SQL queries text before it submit it to the DB, that's frightening).

Just copy the Adminer PHP file at some location of you web server, open the corresponding URL. After you logged-in and selected a data-base, below the list of tables, you will see a list of the stored procedures, with a Call button. Clicking on the procedure link, you will also be able to alter (edit) it.

Honestly, I recommand you gave up with PHPMyAdmin, it's perfectly incapable of properly dealing with this (note that SQLBuddy too, fails in some way with that).

-- edit --

For completeness, you may also list stored procedures with this SQL query:

show procedure status;

Or this one, to retrieve a procedure whose name is known:

show procedure status where Name = 'name';

[1]: http://www.adminer.org/ "Adminer"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDennis MartinezView Question on Stackoverflow
Solution 1 - Mysqlravi404View Answer on Stackoverflow
Solution 2 - MysqlNicola CossuView Answer on Stackoverflow
Solution 3 - MysqlLuis Felipe Barnett VView Answer on Stackoverflow
Solution 4 - MysqlAravindan RView Answer on Stackoverflow
Solution 5 - MysqlsteffenView Answer on Stackoverflow
Solution 6 - MysqlKarimView Answer on Stackoverflow
Solution 7 - MysqlscumdoggView Answer on Stackoverflow
Solution 8 - MysqlMahadeva PrasadView Answer on Stackoverflow
Solution 9 - MysqlRodrigo PoloView Answer on Stackoverflow
Solution 10 - MysqlHMRView Answer on Stackoverflow
Solution 11 - MysqlHibou57View Answer on Stackoverflow