Capturing MySQL Queries

               Capturing MySQL Queries


I know there is mytop, mtop, and innodbtop out there, just google them, but it can be very hard to Freeze The Frame to get every query.  So, here’s a quick and dirty script to catch the queries and see what you users are doing.


#!/bin/sh
#./run_show_full_processlist.ksh > SHOW_PROCCESSLIST.doc &
x=1
while [ $x -le 3600 ]                      #Loop for 1 Hour (60sec * 60 = 3600)
do
echo "START TIME"
date
echo "show full processlist;" | mysql –h HOSTNAME -uUSERNAME -pPASSWD
  x=$(( $x + 1 ))
echo "END DATE"
date
sleep 1                              #snooze for a second
done                                 #End when 3600 tries is reached





Comments

Popular posts from this blog

PostgreSQL Database Version 13.4 To MySQL Database Version 8.0.20 Migration by using SQLines Tool

How to Calculate Bin Log Sizes