如何在 phpMyAdmin 中查看我的存储过程?

发布于 2024-11-09 22:30:39 字数 178 浏览 4 评论 0原文

我在 phpMyAdmin 中创建了一个存储过程

CREATE PROCEDURE Sample()
SELECT * FROM feedback

我在哪里可以查看这个过程?如果在 phpMyAdmin 中不可能,那么有哪些好的程序具有编写、存储和查看存储过程、表等的功能?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

南冥有猫 2024-11-16 22:30:45

单击“主页”、“数据库”、我在其中创建过程的数据库后。它会打开该数据库的结构窗口。
在菜单栏中:“结构、sql、搜索...”应该有例程,如果没有,则单击名为“更多”的正确项目,它应该在那里(诅咒我的上网本没有 24 英寸屏幕)。

为了确保您的数据库具有过程,请单击导出,选择“自定义 - 显示所有可能的选项”,在“输出:”下选择“以文本形式查看输出”,在“特定于格式的选项:”下选择“结构”(就在“转储表”),确保选择“添加 CREATE PROCEDURE / FUNCTION / EVENT 语句”(就在“转储表”下的一点)。
现在单击“Go”,您的过程应该使用以下命令显示


版本信息:3.5.2,最新稳定版本:3.5.2.2

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

软的没边 2024-11-16 22:30:45

使用管理员数据库界面。与 PHPMyAdmin 不同的是,它完全能够查看、编辑和调用存储过程,而 PHPMyAdmin 会因大量错误而失败(当您尝试运行 SQL 语句来创建存储过程时出错,当您尝试调用存储过程时出错,当您尝试更改存储过程时出错)一个已经创建的,除了它无法列出定义的......我真的想知道 PHPMyAdmin 在将 SQL 查询文本提交到数据库之前如何处理它,这太可怕了)。

只需将 Adminer PHP 文件复制到 Web 服务器的某个位置,打开相应的 URL。登录并选择数据库后,在表列表下方,您将看到存储过程列表,并带有“调用”按钮。单击程序链接,您还可以更改(编辑)它。

老实说,我建议您放弃 PHPMyAdmin,它完全无法正确处理这个问题(请注意,SQLBuddy 也以某种方式失败了)。

-- 编辑 --

为了完整起见,您还可以使用此 SQL 查询列出存储过程:

show procedure status;

或者用此查询来检索名称已知的过程:

show procedure status where Name = 'name';

Use the Adminer data-base interface. 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';
樱娆 2024-11-16 22:30:44

在 PHPMYADMIN 在此处输入图像描述3.5.2.2 版本中,您只需单击顶部的例程链接即可。请参阅附图

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

救赎№ 2024-11-16 22:30:44
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.
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.
圈圈圆圆圈圈 2024-11-16 22:30:44

不要忘记,在较小的屏幕中,您必须使用“更多”菜单。
phpMyAdmin

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

上课铃就是安魂曲 2024-11-16 22:30:43

在 phpMyAdmin 下,单击您的数据库(不在表格上),然后单击“+例程”。

在那里您可以编辑/删除所有存储过程

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

There you can edit/drop all your stored procedures

甜点 2024-11-16 22:30:42

如果您不想每次都使用 SQL,您可以选择“information_schema”作为数据库并查询“routines”表中的所有条目。

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.

脸赞 2024-11-16 22:30:41
select routine_definition
from information_schema.routines
where routine_schema = 'db_name'
and routine_name = 'sp_name';
select routine_definition
from information_schema.routines
where routine_schema = 'db_name'
and routine_name = 'sp_name';
£冰雨忧蓝° 2024-11-16 22:30:41

答案展示了如何在没有脚本的情况下查看它们。

“创建存储过程后,它将出现在表下方的例程字段集中(在“结构”选项卡中),并且您可以轻松更改/删除它。”

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."

征棹 2024-11-16 22:30:41

总之你可以使用这个sql

SHOW CREATE PROCEDURE Sample;

更多信息在这里

更新:如果您不记得名称,可以查询INFORMATION_SCHEMA 数据库来查看所有过程(如果您还记得部分名称,您可以在 ROUTINE_NAME 上使用 LIKE)

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

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';
蓦然回首 2024-11-16 22:30:40

在 phpmyadmin 中查看存储过程:

查询:

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

以下是如何在 phpmyadmin 中到达该位置。

phpmyadmin 截图

例程选项在phpmyadmin中可用。除非您至少有一个存储过程,否则该链接在 PHPmyadmin 中不可见。请参阅上图,然后单击 struct 选项卡下的 routines 链接。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文