MySql 工作台查询历史(上次执行的查询/查询)即创建/更改表、选择、插入更新查询

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26609074/
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 13:09:51  来源:igfitidea点击:

MySql workbench query history ( last executed query / queries ) i.e. create / alter table, select, insert update queries

mysqlmysql-workbenchhistory

提问by murtaza.webdev

Want to see last executed queries in MySql Workbench whether its

想在 MySql Workbench 中查看上次执行的查询是否

create / alter table query

select / insert / update query or any query list.

创建/更改表查询

选择/插入/更新查询或任何查询列表。

in short want to see history of all queries

简而言之,想查看所有查询的历史记录

回答by Philip Olson

From the bottom panel, change "Action Output" to "History" and then choose the appropriate date.

在底部面板中,将“Action Output”更改为“History”,然后选择适当的日期。

Alternatively, the SQL statement history is stored in text files under two locations:

或者,SQL 语句历史记录存储在两个位置的文本文件中:

  • sql_history/yyyy-mm-dde.g., sql_history/2015-04-01: Full Workbench SQL history for all MySQL connections
  • log/sql_actions_.log*: SQL history execution results, but without the data, and separated per MySQL connection
  • sql_history/yyyy-mm-dd例如,sql_history/2015-04-01:所有 MySQL 连接的完整工作台 SQL 历史记录
  • log/sql_actions_.log*:SQL历史执行结果,但不带数据,按MySQL连接分开

The location of these files depends on your system. For additional details, see MySQL Workbench Settings and Log Files

这些文件的位置取决于您的系统。有关其他详细信息,请参阅 MySQL Workbench 设置和日志文件

In both cases, you will see the query history.

在这两种情况下,您都会看到查询历史记录。

enter image description here

在此处输入图片说明

回答by Alex

C:\Users[WinUser]\AppData\Roaming\MySQL\Workbench\sql_history

C:\Users[WinUser]\AppData\Roaming\MySQL\Workbench\sql_history

you find a log file for each day. It includes manual and automated queries from workbench (e.g. UPDATES via edit in Table)

您会找到每天的日志文件。它包括来自工作台的手动和自动查询(例如,通过在表中编辑进行更新)

回答by Miguel Loya

You will find a complete History file in:

您将在以下位置找到完整的历史记录文件:

C:\Users\[WinUser]\AppData\Roaming\MySQL\Workbench\log\sql_actions_unconnected.txt

C:\Users\[WinUser]\AppData\Roaming\MySQL\Workbench\log\sql_actions_unconnected.txt

MySQL Workbench could not open History file for some reason, but I was able to recover my unsaved queries by browsing this history file.

由于某种原因,MySQL Workbench 无法打开历史文件,但我能够通过浏览此历史文件来恢复未保存的查询。

回答by Mr-IDE

Suppose that you can no longer connect to a previous MySQL database instance, and you just want to see your SQL history from the editors. Do this:

假设您无法再连接到以前的 MySQL 数据库实例,而您只想从编辑器中查看您的 SQL 历史记录。做这个:

  1. Locate your MySQLWorkbench settings folder:

    • Windows: %AppData%\MySQL\Workbench\
    • macOS: /Users/~username/Library/Application Support/MySQL/Workbench/
    • Linux: /Users/~username/.mysql/workbench/
  2. Open the folder sql_workspaces

  3. You should see folders of your previous database connections. Navigate into one of them.

  4. There should be several "*.scratch" files. They are text files of editor history of SQL queries.

  5. Open these *.scratch files in a text editor, and copy the contents.

  1. 找到您的 MySQLWorkbench设置文件夹

    • 视窗: %AppData%\MySQL\Workbench\
    • 苹果系统: /Users/~username/Library/Application Support/MySQL/Workbench/
    • Linux: /Users/~username/.mysql/workbench/
  2. 打开文件夹 sql_workspaces

  3. 您应该会看到以前数据库连接的文件夹。导航到其中之一。

  4. 应该有几个“*.scratch”文件。它们是SQL 查询编辑器历史记录的文本文件

  5. 在文本编辑器中打开这些 *.scratch 文件,然后复制内容。