本文介绍了MySQL 查询来自 TCP 而不是 MySQL 协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Windows 上的 Wireshark 通过我的 Web 应用程序和 MySQL 服务器捕获 MySQL 活动.我已经看到大多数有关捕获与 MySQL 相关的数据包的问题都返回 MySQL 协议以及查看发送的查询及其响应的可能性.然而,当运行 Wireshark 并使用我的应用程序时,我只能看到 TCP 数据包来来往往,如下面链接中的图片所示.

I'm trying to capture MySQL activities through my web application and MySQL Server by using Wireshark on Windows. I've seen that most of questions about capturing packets related to MySQL return MySQL Protocol and the possibility of seeing the queries sent and their responses. Yet, when running Wireshark and using my application, I see only TCP packets coming and going, as can be seen in the pictures in the links below.

TCP 数据包 -> Src - Dst

内部 TCP 数据包

需要注意的是,我已经使用 tshark 和 WinDump 等工具通过网络收集数据包,但没有任何效果.

It's important to note that I've used tools like tshark and WinDump to collect packets through the network, but nothing worked.

我做错了什么还是 Wireshark 的错误?

Am I doing something wrong or it's a Wireshark bug?

感谢您的回答!我按照克里斯托弗的建议做了编辑 -> 首选项 -> 协议 -> MySQL.没有像端口号"这样的东西,但问题是没有选择在 INFO 列中显示 SQL 查询字符串".

Thanks for the answers!I did what was suggested by Christopher following Edit -> Preferences -> Protocols -> MySQL. There was nothing like "Port Number", but the issue was that "Show SQL Query string in INFO column" was not selected.

推荐答案

图片 提供表示使用的端口是 3307,但 MySQL 解析器默认注册在 端口3306,也就是IANA 注册端口,用于 mysql 流量.因此,当使用非标准端口时,您必须使用 Wireshark 的 Decode As" 功能,如 nnovich-OK 已经提到过.

The image provided indicates that the port in use is 3307, but the MySQL dissector registers by default on port 3306, which is the IANA-registered port for mysql traffic. So, when a non-standard port is used, you must make use of the "Decode As" feature of Wireshark, as nnovich-OK has already mentioned.

在许多情况下,另一个选项(遗憾的是在这种情况下尚不可用)是更改解剖器注册的端口号.尽管 MySQL 解剖器不提供端口首选项,但您可以打开 Wireshark 错误报告,要求要添加这样的偏好 - 如果您提交实际实现它的补丁,那就更好了.一旦首选项可用,您就可以通过 Edit -> 根据需要进行设置.首选项 ->协议 ->MySQL ->端口号,类似于允许配置端口的其他解剖器的数量.

Another option in many cases, which unfortunately is not yet available in this case, is to change the port number that the dissector registers for. The MySQL dissector does not offer a port preference though, but you could open a Wireshark bug report asking for such a preference to be added - even better if you submit a patch that actually implements it. Once a preference is available, then you could set it as desired via Edit -> Preferences -> Protocols -> MySQL -> Port Number, similar to how many other dissectors allow a configurable port.

这篇关于MySQL 查询来自 TCP 而不是 MySQL 协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 04:54