In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "how to use mysqlsniffer to capture SQL statements", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to capture SQL statements using mysqlsniffer.
Before MySQL5.1, general log cannot be enabled or disabled at runtime. Sometimes it is troublesome to capture SQL to find problems. Accidentally, I found a very good gadget: mysqlsniffer, which can be used to capture SQL statements. The help is as follows:
Mysqlsniffer-help
Mysqlsniffer v1.2-Watch MySQL traffic on a TCP/IP network
Usage: mysqlsniffer [OPTIONS] INTERFACE
OPTIONS:
-- port N Listen for MySQL on port number N (default 3306)
-- verbose Show extra packet information
-- tcp-ctrl Show TCP control packets (SYN, FIN, RST, ACK)
-- net-hdrs Show major IP and TCP header values
-- no-mysql-hdrs Do not show MySQL header (packet ID and length)
-- state Show state
-- v40 MySQL server is version 4.0
-- dump Dump all packets in hex
-- help Print this
Original source code and more information at:
Http://hackmysql.com/mysqlsniffer
INTERFACE refers to the network card number, such as eth0,eth2,lo, etc.
Of course, there are also people who directly tcpdump to capture, the method is as follows: [@ more@]
Tcpdump-I eth2-s 0-l-w-dst port 3306 | strings | perl-e'
While () {chomp; next if / ^ [^] + [] * $/
If (/ ^ (SELECT | UPDATE | DELETE | INSERT | SET | COMMIT | ROLLBACK | CREATE | DROP | ALTER) / I) {
If (defined $Q) {print "$qn";}
$qcommodity _
} else {
$_ = ~ s / ^ [t] + / /; $q.= "$_"
}
}'
At this point, I believe you have a deeper understanding of "how to use mysqlsniffer to capture SQL statements". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.