Change MySQL Binary Log File Location To Another Directory
Follow the below steps to change MySQL binary log file location to another directory.
1. Edit the log-bin variable in my.cnf file located in /etc/my.cnf to log-bin=/new/directory/path/mysql-bin .
# vi /etc/my.cnf ...... ......... log-bin=/new/directory/path/mysql-bin ..... .......
Save and close the file.
2. To minimize the number of moved files, purge as many files as you can ( PURGE BINLOG…).
3. Stop MySQL server.
# service mysqld stop
4. Now move the all mysql-bin file to new directory.
# mv /var/lib/mysql/mysql-bin.* /new/directory/path
5. Start MySQL server again.
# service mysqld start