Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I connect to mysql client using the command

mysql -uroot -p

And I execute queries there. If I press the up arrow, i could see the history of almost all the queries there. Where will this query log be stored.

I found a log file under /var/log/mysql/mysql.log and I indeed see some logging happening there. But it has queries from other users as well. However, I only need queries executed by the specific user (root in this case). How to get it? Please help me.

Note: I need to debug some logs, so a solution to filter these logs with the existing setup would be great.

share|improve this question
up vote 6 down vote accepted

History for root is stored in /root/.mysql_history.

share|improve this answer
thanks for the answer ! – bragboy Aug 27 '12 at 11:52
You're welcome :) – dave Aug 27 '12 at 12:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.