Use Wireshark to view MySQL interactive data captured by tcpdump

Source: Internet
Author: User
Tags mysql client

Use tcpdump to crawl MySQL client interaction with server side

1 Opening tcpdump

Tcpdump-i eth0-s Port 3306-w ~/sql.pcap

First intentionally entering an incorrect password

[[Email protected] ~] # mysql-h192.168.100.206-uroot-p Enter Password: for user ' root ' @ ' 192.168.11.201 ' (using Password:yes)

Enter the correct password to enter and perform a series of operations

[[Email protected] ~]#mysql-h192.168.100.206-uroot-pEnter Password:Welcome to theMySQLMonitor. CommandsEndwith; or \g.YourMySQLConnection ID is 442447Server version: 5.5.25-LogSource Distributioncopyright (c)The Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or Itsaffiliates.Other names trademarks of their respectiveowners.Type' Help; ' or ' \h ' forHelp. Type ' \c ' to clear the CurrentInput statement.MySQL> UseJwbx;database changedMySQL> select * from Jwbx_customer limit 10;

Open Sql.pcap file with Wireshark

The wrong password entered

Request 6 0.001146 192.168.11.201 192.168.100.206 MySQL Login Request user=root

Response 8 0.001636 192.168.100.206 192.168.11.201 MySQL 147 Response Error 1045

Landing success

4.953321 192.168.11.201 192.168.100.206 MySQL Login Request user=root

Greetings from the server side

4.952968 192.168.100.206 192.168.11.201 MySQL 148 Server Greeting proto=10 version=5.5.25- Log

Server-side status

Access

SELECT @ @version_comment Limit 1 returns to Source distribution

SELECT DATABASE ()

Use database return name

Access to SQL

Return

You can also access MySQL data in the crawler to see which SQL statements were executed

It is also possible to use the Wireshark method as follows:

# tcpdump-i any-a-S Port 3306 >~/sql.log
#grep "SELECT * from" ~/Sql.log|head

Note:-A prints out all the groupings in ASCII format and minimizes the head of the link layer. The SQL statements that are transmitted to the MySQL server are transmitted in ASCII format. We can use the-a parameter to view the specific SQL statements that are transmitted.

Use Wireshark to view MySQL interactive data captured by tcpdump

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.