generallamp

Disable binary logging in MySQL

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

Binary logging is enabled by default in MySQL 8.x and later. Follow the steps below to disable it:

  • Stop the MySQL server:

    $ sudo /opt/bitnami/ctlscript.sh stop mysql
    
  • Edit the MySQL configuration file, which depending on your installation type will be in one of the following locations:

    * For Bitnami installations following Approach A (using Linux system packages): */opt/bitnami/mysql/conf/my.cnf*
    * For Bitnami installations following Approach B (self-contained installations): */opt/bitnami/mysql/my.cnf*
    
  • Add the line below in the [mysqld] configuration block, such that the result looks like this:

    [mysqld]
    disable_log_bin
    ...
    
  • Start the MySQL server:

    $ sudo /opt/bitnami/ctlscript.sh start mysql
    

Existing binary log files will be automatically removed after 30 days, which is the default expiry period. To remove them manually, use the PURGE BINARY LOGS command described in the official MySQL documentation.

Last modification October 20, 2020