MySQL 有没有办法用phpmyadmin查看过去的mysql查询?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3247229/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 16:33:23  来源:igfitidea点击:

Is there a way to view past mysql queries with phpmyadmin?

mysqlphpmyadmin

提问by chris1979

I'm trying to track down a bug that's deleting rows in a mysqltable.

我正在尝试追踪删除mysql表中行的错误。

For the life of me I can't track it down in my PHPcode, so I'd like to work backwards by finding the actual mysql query that's removing the rows.

在我的一生中,我无法在我的PHP代码中追踪它,所以我想通过查找删除行的实际 mysql 查询来向后工作。

I logged in to phpmyadmin, but can't find a way to view the history of past sql operations.

我登录了phpmyadmin,但是找不到查看过去sql操作历史的方法。

Is there a way to view them in phpmyadmin?

有没有办法在 phpmyadmin 中查看它们?

回答by chris1979

Ok, so I actually stumbled across the answer.

好的,所以我实际上偶然发现了答案。

phpMyAdmin does offer a brief history. If you click on the 'sql' icon just underneath the 'phpMyAdmin' logo, it'll open a new window. In the new window, just click on the 'history' tab.

phpMyAdmin 确实提供了一个简短的历史。如果您单击“phpMyAdmin”徽标下方的“sql”图标,它将打开一个新窗口。在新窗口中,只需单击“历史记录”选项卡。

That will give you the last twenty or so SQL operations.

这将为您提供最后二十个左右的 SQL 操作。

enter image description here

在此处输入图片说明

回答by alleyoopster

There is a Consoletab at the bottom of the SQL(query) screen. By default it is not expanded, but once clicked on it should expose tabs for Options, Historyand Clear. Click on history.

SQL(查询)屏幕底部有一个控制台选项卡。默认情况下它不展开,但一旦点击它应该会显示选项、历史和清除选项卡。点击历史记录。

The Query history lengthis set from within Page Related Settingswhich found by clicking on the gear wheel at the top right of screen.

所述查询历史长度是从内设置页面相关设置其中发现通过点击在屏幕的右上角的齿轮。

This is correct for PHP version 4.5.1-1

这适用于 PHP 版本 4.5.1-1

回答by Samarth Saxena

You just need to click on console at the bottom of the screen in phpMyAdminand you will get the Executed history:

您只需要在phpMyAdmin 中单击屏幕底部的控制台,您将获得已执行的历史记录:

enter image description here

在此处输入图片说明

回答by Waqas Bukhary

To view the past queries simply run this query in phpMyAdmin.

要查看过去的查询,只需在 phpMyAdmin 中运行此查询。

SELECT * FROM `general_log`

if it is not enabled, run the following two queries before running it.

如果未启用,请在运行前运行以下两个查询。

SET GLOBAL log_output = 'TABLE';
SET GLOBAL general_log = 'ON';

回答by baol

I don't think phpMyAdmin lets you do that, but I'd like to hear I'm wrong.

我不认为 phpMyAdmin 允许您这样做,但我想知道我错了。

On the other hand you can enable query logging in MySQL: The General Query Log

另一方面,您可以在 MySQL 中启用查询日志:通用查询日志

回答by blueyed

Yes, you can log queries to a special phpMyAdmin DB table.

是的,您可以将查询记录到特殊的 phpMyAdmin 数据库表中。

See SQL_history.

请参阅SQL_history

回答by Dhinakar

I am using phpMyAdmin Server version: 5.1.41.

我正在使用 phpMyAdmin 服务器版本:5.1.41。

It offers possibility for view sql history through phpmyadmin.pma_historytable.

它提供了通过phpmyadmin.pma_history表查看 sql 历史记录的可能性。

You can search your query in this table.

您可以在此表中搜索您的查询。

pma_historytable has below structure:

pma_history表具有以下结构:

enter image description here

在此处输入图片说明

回答by Anurag Prashant

You have to click on query window just below the phpMyAdmin logo, a new window will open. Just click on SQL History tab. There you can see history of SQL Queries.

您必须单击 phpMyAdmin 徽标正下方的查询窗口,将打开一个新窗口。只需单击 SQL History 选项卡。在那里您可以看到 SQL 查询的历史记录。

回答by Mark Baker

I may be wrong, but I believe I've seen a list of previous SQL queries in the session file for phpmyadmin sessions

我可能错了,但我相信我已经在 phpmyadmin 会话的会话文件中看到了以前的 SQL 查询列表

回答by Hymanherer

OK so I know I'm a little late and some of the above answers are great stuff.

好的,所以我知道我有点晚了,上面的一些答案很棒。

As little extra though, while in any PHPMyAdmin page:

不过,在任何 PHPMyAdmin 页面中,还有一点额外:

  1. Click SQL tab
  2. Click 'Get auto saved query'
  1. 单击 SQL 选项卡
  2. 单击“获取自动保存的查询”

this will then show your last entered query.

这将显示您最后输入的查询。