0

I have an MySQL server and I saw that it did not accept any connection because of there was no enough space in disc. I checked the log files of mysql and their size were 480GB(almost as the disc capacity). When I delete these log files manually the server became to serve again and accepted connections. How can I solve that issue? Can I make a command to delete MySQL log files whenever their size is grown enough? or should I do something else like not to log everything. What should I do and how can I do? Please help (ubuntu 18.04).

3
  • Your question itself mentions 18.04, but you tagged 14.04?? Please clarify
    – guiverc
    Dec 15, 2020 at 10:29
  • there were no an option for ubuntu 18.04
    – Nutabella
    Dec 17, 2020 at 5:11
  • fyi: 18.04 is there, type 18.04 & wait.. it'll appear.. 14.04 is the most recent release having had it's full supported life cycle for this site (5 years of users selecting it, it still gets hits by users who tag it wrongly today..) so it bubbles to the top fastest.. 18.04 is only ~half way through it's cycle but is still there..
    – guiverc
    Dec 17, 2020 at 5:17

1 Answer 1

1

When I delete these log files manually the server became to serve again and accepted connections

Please do not delete them and empty them using > mysql.log. It is a better practice: sometimes software expects the log to be there when that software is running and it can crash when it tries to write to it when it is gone. Emptying also preserves permissions.

How can I solve that issue?

Use logrotate. Here is an example script.

1
  • I could not understant well to implement that and I tried this: scalegrid.io/blog/… will this be enough? Or what changes should I do?
    – Nutabella
    Dec 17, 2020 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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