How to remove bin logs and turn it off

Updated: 19th December 2022
Tags: mysql

If your mysql eats enormous amount of space, check if binary logging is on

Check if binlog creating is on

show variables like 'log_bin';

If it is on it will create lots of bin log files on mysql/data folder.

If you have only simple mysql database without master / slaves / replication stuff, you have opportunity to get free space and block creating bin logs in the future.

Purge existing bin logs

PURGE BINARY LOGS TO 'mysql-bin.010';
PURGE BINARY LOGS BEFORE '2019-04-02 22:46:26';

Block creating binlogs

// /etc/mysql/my.cnf

and restart mysql server