To find total number of mysql queries, mysql users and mysql load
by rajesh[ Edit ] 2012-07-31 10:46:45
Mysql SLA is a free tool that can be used to analyze the user queries in a mysql server. This will help you to find which accounts run which queries and how many times the queries where executed.
1) Enable mysql logging of general queries
To enable general log by following the steps:
create mysql log file with proper permissions
# cd /var/log
# mkdir mysql
# cd mysql
# touch general.log
# cd ..
# chown -R mysql:mysql mysql
# chmod 777 mysql
Enable logging in my.cnf [to location of my.cnf may vary depending on how you installed it, use locate or find to fins the file path of my.cnf]
Edit my.cnf
# vim /etc/my.cnf
Inside it add
# log = "/var/log/mysql/general.log"
2) Now restart mysql
3) Now download mysqlsla
wget http://hackmysql.com/scripts/mysqlsla
4) After letting the mysql run for a period of time,
run mysqlsla commad with log file path as argument.
mysqlsla-2.03 -lt general /var/log/mysql/general.log