The binary log is a set of log files that contain information about data modifications made to a MySQL server instance. The log is enabled by starting the server with the –log-bin option. It was introduced in MySQL 3.23.14. There are two types of binary logging:
- Statement-based logging
- Row-based logging
In earlier MySQL versions, binary logging was disabled by default but from MySQL 8.0, binary logging is enabled by default. When binary logging is enabled, it may consume more disk space. MySQL database performance and connectivity can be affected by low disk space and/or low available memory. We can disable binary logging by specifying the –skip-log-bin or –disable-log-bin option at startup.
Disabling the binary logging in Bitnami can be done using the steps given below:
- Find out the location of the MySQL log file
The main MySQL log file is located at one of the following locations, on the MySQL database server host:For Bitnami installations using Linux system packages: /opt/bitnami/mysql/logs/mysqld.log For Self-contained Bitnami installations: /opt/bitnami/mysql/data/mysqld.log
- Stop the MySQL server using the command given below:
sudo /opt/bitnami/ctlscript.sh stop mysql
- Edit the MySQL configuration file, depending on your installation type
For Bitnami installations using Linux system packages: */opt/bitnami/mysql/conf/my.cnf* For Self-contained Bitnami installations: */opt/bitnami/mysql/my.cnf*
- Add the line `disable_log_bin` below in the [mysqld] configuration block.
After adding the line, the conf will look like as shown below:[mysqld] disable_log_bin ...
- Start the MySQL server
sudo /opt/bitnami/ctlscript.sh start mysql
Now the binary logging will be disabled and the existing binary log files will be automatically removed after 30 days, which is the default expiry period.
To remove the binary log files manually, run the commands given below in the MySQL command prompt after logging in as MySQL root user.
PURGE BINARY LOGS TO 'bin_log000095'; PURGE BINARY LOGS BEFORE '2021-04-02 22:30:20';
The BEFORE variant’s datetime_expr argument should evaluate to a DATETIME value (a value in ‘YYYY-MM-DD hh:mm:ss’ format). Also, don’t forget to use the appropriate log name (as specified in the server) in place of ‘bin_log000095’.
After running these commands, the binary logs will be removed.
We are one of the best Server Management Company in India, Our expert team in web hosting and server management provides professional helpdesk support around the clock with guaranteed response and resolution time.
LET US TAKE CARE OF YOUR SERVERS 24/7/365.
Get rid of all the hassles of server management.
CONTACT US WITH YOUR REQUIREMENTS!