Overview
I find far too often that MySQL error and slow query logs are unaccounted for. Setting up log rotation helps make the logs manageable in the event that they start to fill up and can help make your troubleshooting of issues more efficient.
Setup
All steps in the examples below are run as the root user. The first step is to setup a user that will perform the log rotation. It is recommended to only give enough access to the MySQL user for the task that it is performing.
Create Log Rotate MySQL User
mysql > CREATE USER 'log_rotate'@'localhost' IDENTIFIED BY '<ENTER PASSWORD HERE>'; mysql > GRANT RELOAD,SUPER ON *.* to 'log_rotate'@'localhost'; mysql > FLUSH PRIVILEGES;</pre>
The next step is to setup the MySQL authentication config as root. Here are two methods to set this up. The first method will be the more secure method of …
[Read more]