Skip to main content
Home
badllama.com
  • Search
  • Log In

Analyze MySQL Queries Using tcpdump

bchavet's picture

Thu, 05/26/2011 - 20:23 by bchavet

This is an incredibly useful method of analyzing the queries that your MySQL server is processing without having to change the log level, and subsequently, not having to restart the MySQL server.

First, capture the MySQL queries with tcpdump as they come across the wire

tcpdump port 3306 -s 65535 -x -n -q -tttt > tcpdump.out

When you're done capturing the desired traffic, run mk-query-digest from Maatkit to analyze the tcpdump

mk-query-digest --type=tcpdump tcpdump.out | less
Tags: 
mysql
Powered by Backdrop CMS