Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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.

http://dev.mysql.com/doc/refman/5.1/en/query-log.html

share|improve this answer
    
This kind of logging REALLY slows down MySQL :( –  Kedare Dec 24 '10 at 15:25
1  
@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

 
discard

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.