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

My question is how to stop logs on mysql

log_error = /var/log/mysql/error.log i have commented already.

with slow queries too. But i have one more log file in /var/lib/mysql/hostname.log with hostname I mean that for example I am on server called hulk so the log will be hulk.log and so on. In that log are all queries. So the log is growing really fast and also is really big. So my question is how to disable this log ?

share|improve this question
Why would you want to stop logging? What happens if you need to track down some error? – mdpc Jan 26 '13 at 1:45
up vote 6 down vote accepted

If you would like to dynamically stop logging, login as root@localhost and run this:

SET GLOBAL general_log = 'OFF';

That's it. No restart of mysql needed.

If you are not root@localhost, you will need to be logged in as a user with SUPER privilege.

share|improve this answer
thx man it is works ;) – nonus25 Jan 26 '13 at 21:55
Please accept my answer... – RolandoMySQLDBA Jan 26 '13 at 22:52

In MySQL 5.1.12+ add/change this in your my.cnf

general-log = 0

In MySQL 5.1.11- remove this in your my.cnf



log = 


share|improve this answer
general-log = 0 works fine, but on master I cant do restart so I disable logs like RolandoMySQLDBA said. But on slaves I tries your way and is working also thx – nonus25 Jan 26 '13 at 21:59
In MySQL 5.5.49 , the entry is general_log = 0 – Raptor Jun 3 at 7:56

vim /etc/my.cnf

There are two lines you want to comment out:


Restart mysql by

service mysql restart


service mysqld restart

Logging will be turned off now. Reverse the process when you want to turn it back on (if you do...) :)

share|improve this answer

Generally you would want to keep logs (or better yet, ship off to a log-aggregation service), and also apply logrotate to the local log files.

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.