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).
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.