Blog

How to Disable Binary Logging in MySQL on Bitnami servers?

Published on: January 6, 2022 by Abin Raaj

How to Disable Binary Logging in MySQL on Bitnami servers?

Scenario:

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:

  1. 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
  2. Stop the MySQL server using the command given below:
    sudo /opt/bitnami/ctlscript.sh stop mysql
  3. 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*
  4. 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
    ...
  5. 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!

Category : Linux

Abin Raaj

Abin Raaj

Abin Raaj is currently working as System Engineer at SupportSages. He is well-versed in Linux and server management and interested in new technologies. The dedication and work-ethic he shows in the workplace combined with his ability to build good relationships and decision-making skill has earned him the role of Team Leader. He is proficient in WordPress and loves working with WordPress websites. In his free time, Abin enjoys playing football, badminton, and discovering new music.

You may also read:

Comments

Add new commentSIGN IN

Let's Connect

Categories

Your Cart

Cart is empty.

Subtotal
₹0.00
APPLY
0
Send this to a friend