Matomo Analytics

Bin logs in MySQL are used for various purposes, including point-in-time recovery, replication, and auditing. However, in some cases, you may want to disable bin logs to reduce disk usage or improve database performance. Here's a step-by-step guide to disabling bin logs in MySQL:

1. Open your MySQL configuration file. Depending on your system, the location of this file may vary. For example, on Ubuntu, the configuration file is typically located at /etc/mysql/mysql.conf.d/mysqld.cnf.

2. Look for the [mysqld] section in the configuration file. This section contains the configuration options for the MySQL server.

3. Add the following line to the [mysqld] section to disable bin logs:

skip-log-bin

4. Save the configuration file and restart the MySQL server to apply the changes. On Ubuntu, you can restart the MySQL server using the following command:

sudo service mysql restart

5. Verify that bin logging is disabled by connecting to the MySQL server and running the following command:

SHOW VARIABLES LIKE 'log_bin';

If bin logging is disabled, the output of this command should be:

+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin       | OFF   |
+---------------+-------+
1 row in set (0.00 sec)

If bin logging is still enabled, make sure that you have edited the correct configuration file and restarted the MySQL server.

That's it! Bin logging is now disabled in MySQL, and the server will no longer write binary log files. However, keep in mind that disabling bin logging may have consequences, such as making point-in-time recovery and replication more difficult or impossible. Therefore, it's important to carefully consider whether disabling bin logging is the right choice for your use case.

24 February 2023 (last updated 1 year ago)

5401 views

Written by Dennis

Dennis brings over 6 years of hands-on experience in server management, specializing in optimizing web services for scalability and security.

Back to Server


Start free trial