如何从 SHOW PROCESSLIST 查看完整查询?
当我发出 SHOW PROCESSLIST
查询时,信息列中仅返回正在运行的 SQL 查询的前 100 个字符。
是否可以更改 MySQL 配置或发出不同类型的请求来查看完整的查询(我正在查看的查询长度超过 100 个字符)
When I issue SHOW PROCESSLIST
query, only the first 100 characters of the running SQL query are returned in the info column.
Is it possible to change MySQL config or issue a different kind of request to see complete query (the queries I'm looking at are longer than 100 characters)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
如果您不使用
FULL
, “Info
字段中仅显示每条语句的前 100 个字符”。使用 phpMyAdmin 时,您还应该单击“全文”选项(结果表左上角的“← T →”)以查看未截断的结果。
If you don't use
FULL
, "only the first 100 characters of each statement are shown in theInfo
field".When using phpMyAdmin, you should also click on the "Full texts" option ("← T →" on top left corner of a results table) to see untruncated results.
Show Processlist 从另一个表中获取信息。以下是如何提取数据并查看包含整个查询的“INFO”列:
您可以根据您的要求添加任何条件或忽略。
查询的输出结果为:
Show Processlist fetches the information from another table. Here is how you can pull the data and look at 'INFO' column which contains the whole query :
You can add any condition or ignore based on your requirement.
The output of the query is resulted as :
查看 SHOW PROCESSLIST 的完整查询:
或者
See full query from SHOW PROCESSLIST :
Or
我刚刚在MySQL文档中读到
显示完整的进程列表 默认情况下仅列出来自当前用户连接的线程。
引用 MySQL SHOW FULL PROCESSLIST 文档:
因此,您可以启用
mysql.user
表中的Process_priv
列。记得之后执行FLUSH PRIVILEGES
:)I just read in the MySQL documentation that
SHOW FULL PROCESSLIST
by default only lists the threads from your current user connection.Quote from the MySQL SHOW FULL PROCESSLIST documentation:
So you can enable the
Process_priv
column in yourmysql.user
table. Remember to executeFLUSH PRIVILEGES
afterwards :)如果希望在 shell 会话上不断获取更新的进程(在本例中为 2 秒),而无需手动与其交互,请使用:
show [full] processlist
的唯一缺点是您无法过滤输出结果。另一方面,发出 SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST 可以从输出中删除您不想看到的任何内容:If one wants to keep getting updated processes (on the example, 2 seconds) on a shell session, without having to manually interact with it, use:
The only bad thing about the
show [full] processlist
is that you can't filter the output result. On the other hand, issuing theSELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
open possibilities to remove from the output anything you don't want to see:这显示了包含更多信息的完整进程列表。
This shows the full processlist with more info.
bash
mysql
bash
mysql
在 phpmyadmin 中必须启用全文选项。
In phpmyadmin must enable Full texts in option.