Suppose the error log file has become bigger and you want to rotate it; you can simply move the file and execute the FLUSH LOGS command:
shell> sudo mv /var/log/mysql/mysqld.log /var/log/mysql/mysqld.log.0; shell> mysqladmin -u root -p<password> flush-logsmysqladmin: [Warning] Using a password on the command line interface can be insecure.shell> ls -lhtr /var/log/mysql/mysqld.log-rw-r-----. 1 mysql mysql 0 Oct 10 14:03 /var/log/mysql/mysqld.logshell> ls -lhtr /var/log/mysql/mysqld.log.0 -rw-r-----. 1 mysql mysql 3.4K Oct 10 14:03 /var/log/mysql/mysqld.log.0
You can automate the preceding steps using some scripts and put them into cron.
If the location of an error log file is not writable by the server, the log-flushing ...