Is there a way I can find out how many select, update, insert and rest of the queries have been executed by MySQL server ? Can it be in last 1 day or week ?
2 Answers
Yes, there is a way! You can set the server to write logs about client connects/disconnects and every statement which was executed to a log file. Have a look here.
3 Comments
mrd081
thanks for the answer. is it recommended to keep it on during production environment always ?
stb
Sure, if you want to log the queries in some way, it has to. If you need it to inspect a particular error, you can turn it on just for the duration you need it to. Anyways, it's a good position for you to have an insight what queries are executed on your machine for troubleshooting.
mrd081
i didnt know much about these concept as I am new to this site. but I am getting answers pretty immediately. let me accept answers from now on :)
Start General Query Log, it allows storing log info into table.
Then write a SELECT query to read data from mysql.general_log table, add WHERE condition to filter result by date. Then analyze (parse) data from the argument field, it contains executed queries.