How7o
  • Home
  • Tools
  • Prank Screens
  • Learn
  • Blog
  • Contact
Reading: How to Disable Binary Logging in MySQL or MariaDB
Share
How7oHow7o
Font ResizerAa
  • OS
Search
  • Home
  • Tools
  • Prank Screens
  • Learn
  • Blog
  • Contact
Follow US
© 2024–2026 How7o. All rights reserved.
How7o > Free Laravel, PHP, WordPress & Server Tutorials > Server Management > How to Disable Binary Logging in MySQL or MariaDB
Server Management

How to Disable Binary Logging in MySQL or MariaDB

how7o
By how7o
Last updated: May 23, 2026
5 Min Read
Disable binary logging in MySQL or MariaDB
SHARE

To permanently disable binary logging in MySQL or MariaDB, stop the service, add skip-log-bin under [mysqld] in my.cnf, and start it again. Verify with SHOW VARIABLES LIKE 'log_bin'; the value should be OFF. Only do this on standalone servers — replication and point-in-time recovery require binary logs.

Contents
  • Step 1 — stop the service
  • Step 2 — edit my.cnf
  • Step 3 — start the service and verify
  • Step 4 — clean up existing log files
  • Alternative — keep binary logs but expire them quickly
  • Frequently asked questions
  • Related guides
  • References

Last verified: 2026-05-17 on MySQL 8.0 and MariaDB 10.11. Originally published 2023-01-25, rewritten and updated 2026-05-17.

Step 1 — stop the service

# MariaDB
sudo systemctl stop mariadb

# MySQL
sudo systemctl stop mysql        # Debian/Ubuntu
sudo systemctl stop mysqld       # RHEL-family

Step 2 — edit my.cnf

# Common locations
sudo vi /etc/my.cnf                                   # RHEL-family
sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf       # Debian/Ubuntu MariaDB
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf            # Debian/Ubuntu MySQL

Under the [mysqld] section, add:

[mysqld]
skip-log-bin

If you already have a log-bin = ... directive, put skip-log-bin after it (or comment out the log-bin line entirely). MariaDB reads top-to-bottom — a later log-bin re-enables binary logging and overrides the skip.

Disable MySQL binary logging — skip-log-bin in my.cnf, verify log_bin variable, alternatives

Step 3 — start the service and verify

sudo systemctl start mariadb    # or mysql / mysqld

mysql -u root -p
SHOW VARIABLES LIKE 'log_bin';

+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin       | OFF   |
+---------------+-------+

If the value is OFF, binary logging is fully off. The server will not produce any more mysql-bin.* files.

Step 4 — clean up existing log files

-- See what's there
SHOW BINARY LOGS;

-- Wipe them (replication-safe — if there are no replicas)
RESET MASTER;        -- MySQL 5.7 / MariaDB
RESET BINARY LOGS AND GTIDS;   -- MySQL 8.4+ replacement

RESET MASTER (or RESET BINARY LOGS AND GTIDS on MySQL 8.4+) drops every binary log file and resets the GTID set. Don’t run this on a server that has replicas — they’ll desync immediately.

Alternative — keep binary logs but expire them quickly

[mysqld]
# MySQL 8.0+ — seconds (default 30 days)
binlog_expire_logs_seconds = 86400    # 1 day

# MySQL 5.7 / MariaDB — days
expire_logs_days = 1

If you want point-in-time recovery for the last day or two but not unbounded growth, expire logs aggressively rather than disabling them. Best of both worlds.

Frequently asked questions

When should I not disable binary logging?

Three cases. (1) You run replication — binary logs are how primary→replica delta-sync works; disable them and replication stops cold. (2) You rely on point-in-time recovery — binary logs are what let you replay changes since the last backup; without them, recovery is limited to whatever your full backup contained. (3) You use Group Replication or InnoDB Cluster — both require binary logs. For a single-instance server with full nightly backups and no replication, disabling is reasonable.

If I just want to keep them small, do I have to disable entirely?

No — set binlog_expire_logs_seconds = 86400 (one day) or whatever retention you can afford in my.cnf. MySQL rotates old binary logs out automatically. This keeps the ability to recover recent state without unbounded disk use. Disable only if you don’t need them at all.

Why does the article warn about skip-log-bin ordering with log-bin?

MariaDB processes my.cnf top-to-bottom. If log-bin = mysql-bin appears after skip-log-bin, the log-bin directive re-enables binary logging and your skip-log-bin does nothing. Either put skip-log-bin after log-bin, or comment out log-bin entirely. Same rule applies to log_bin with an underscore.

What’s the difference between MySQL and MariaDB for this?

Both honor skip-log-bin in [mysqld]. MySQL 8.0 also accepts disable-log-bin as an alias. The cleanup commands (PURGE BINARY LOGS, SHOW BINARY LOGS) are identical. The config-file paths differ on some distros — MySQL on Debian/Ubuntu uses /etc/mysql/mysql.conf.d/mysqld.cnf, MariaDB uses /etc/mysql/mariadb.conf.d/. On RHEL-family, both default to /etc/my.cnf + /etc/my.cnf.d/.

Related guides

  • How to Safely Clean Up MySQL Binary Log Files
  • How to Find What’s Pinning MySQL at 100% CPU
  • How to Troubleshoot MariaDB Not Starting

References

MySQL --skip-log-bin: dev.mysql.com/doc/refman/8.0/en/replication-options-binary-log.html. MariaDB binary logs: mariadb.com/kb/en/activating-the-binary-log. RESET MASTER: dev.mysql.com/doc/refman/8.0/en/reset-master.html.

TAGGED:configurationmariadbmysqlperformance

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
[mc4wp_form]
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Previous Article Switch from LiteSpeed to Apache in WHM/cPanel How to Switch from LiteSpeed to Apache in WHM/cPanel
Next Article Upload files via Ajax with jQuery using FormData How to Upload Files via Ajax with jQuery
Leave a Comment

Leave a Reply Cancel reply

You must be logged in to post a comment.

FacebookLike
XFollow
PinterestPin
InstagramFollow
Most Popular
Run Laravel queue workers with Supervisor
How to Run Laravel Queue Workers in Production with Supervisor
May 23, 2026
Nginx as a reverse proxy for a Node.js app on Ubuntu
How to Set Up Nginx as a Reverse Proxy for Node.js on Ubuntu
May 23, 2026
Install and configure Redis on Ubuntu for Laravel and WordPress
How to Install and Configure Redis on Ubuntu (for Laravel & WordPress)
May 23, 2026
Harden a fresh Ubuntu VPS with UFW, Fail2Ban, and SSH key auth
How to Harden a Fresh Ubuntu VPS: UFW + Fail2Ban + SSH Key Auth
May 23, 2026
Set up Let's Encrypt SSL with Certbot on Ubuntu
How to Set Up Let’s Encrypt SSL with Certbot on Ubuntu (Apache & Nginx)
May 23, 2026

You Might Also Like

Laravel Eloquent group by count — Book::groupBy('author') query with bar-chart aggregate icon
Web Development

How to Count Records Grouped By a Column in Laravel Eloquent

7 Min Read
MySQL connect remote from Ubuntu — mysql-client + mysql -h host
Server Management

How to Connect to a Remote MySQL Database from Ubuntu

7 Min Read
Install the Apache web server on Ubuntu
Server Management

How to Install the Apache Web Server on Ubuntu

7 Min Read
MySQL combine columns into string — CONCAT and CONCAT_WS
Web Development

How to Combine Multiple Columns into One String in MySQL

6 Min Read
How7o

We provide tips, tricks, and advice for improving websites and doing better search.

Tools

  • Age Calculator
  • Word Counter
  • Image Upscaler
  • Password Generator
  • QR Code Generator
  • See all tools→

Pranks

  • Fake Blue Screen Prank
  • Hacker Typer
  • Fake iMessage Generator
  • Windows XP Crash Prank
  • Windows 11 Update Prank
  • See all prank screens →

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service
  • Sitemap
© 2024–2026 How7o. All rights reserved.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?