Thursday, October 1, 2009

Mysqld-bin logs problem

After continuous running of Mysql server, I've noticed that /var/lib/mysql directory uses too much disk space. The reason of that problem was a set of mysqld-bin.xxxxxx files. Each of that file was 1GB in size. First I thought that I can stop the Mysql server and remove that files, but I didn't want to act this way because there was sensitive data in databases that I didn't want to loose. So I found the better way to achieve this. Connect to Mysql server and perform the following

mysql> flush logs;

mysql> reset master;

That's it! After that the all logbin files should be removed. Also you can disable mysqld-bin logging completely by commenting out log-bin line in my.cnf and restarting Mysql server daemon.

10 comments:

  1. I had try to delete this files ,that I found if I delete this files ,mysql server won't start

    ReplyDelete
  2. Old post, but thanks for that! I have a Slicehost and with the limited space, I was wondering where it went. Thanks!

    ReplyDelete
  3. Yes, excellent, thanks!

    ReplyDelete
  4. I really needed this command very badly, indeed. Thank you very much for getting this posted - I don't care how long ago!!!

    ReplyDelete
  5. Yup, saved me from having to search around mysql's site, thanks!

    ReplyDelete