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
Laravel Eloquent ORM — a model class mapping to a database table with query methods
Laravel Eloquent ORM: The Complete Guide to Querying Your Database
June 16, 2026
Set vi as the default editor in Ubuntu — a terminal opening the vim editor
How to Set vi (Vim) as the Default Editor in Ubuntu
June 8, 2026
rsync says ALL DONE but files are missing — a terminal showing ALL DONE next to an empty folder
rsync Says “ALL DONE” but Files Are Missing: How to Verify
June 8, 2026
Migrate a website to a new server with rsync — files copying from an old server to a new one over SSH
How to Migrate a Website to a New Server With rsync
June 8, 2026
Bun runtime — faster JS toolkit replacing npm in Laravel projects
How to Install Bun Runtime on Ubuntu (And Use It in a Laravel Project)
May 24, 2026

You Might Also Like

Laravel leftJoin to keep all records even without matches
Web Development

How to Use LEFT JOIN in Laravel to Keep All Records

4 Min Read
MySQL primary and replica database cylinders connected by replication arrows
Server Management

How to Set Up MySQL Primary-Replica Replication on Ubuntu (Production Guide)

10 Min Read
Fix broken cPanel disk quotas with the fixquotas script
Server Management

How to Fix Quotas in cPanel

5 Min Read
Laravel Eloquent exists method checking if a record exists in a database query
Web Development

How to Check if a Record Exists in Laravel

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?