Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Is there a way to log only certain MySQL operations?

I need to enable it's log in a production server but only for drop/create commands. Unfortunately logging everything is slow and I only need these specific commands.

share|improve this question

There is no sophisticated way to log queries in mysql. The only thing you can do is the following:

The general query log is a general record of what mysqld is doing. The server writes information to this log when clients connect or disconnect, and it logs each SQL statement received from clients. The general query log can be very useful when you suspect an error in a client and want to know exactly what the client sent to mysqld.

share|improve this answer
This kind of logging REALLY slows down MySQL :( – Kedare Dec 24 '10 at 15:25
@Kedare, yeah +IO and usually mysql is IO bound anyway. – Istvan Dec 25 '10 at 18:33

you can try having binlog turned on. it'll not hit your performance as badly as regular logs [only commands changing the data are logged]. but it might be not suitable for your needs if you for instance want to log from which ip given drop command was issued.

share|improve this answer

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.