How7oHow7o
  • Home
  • Tools
    • All Tools
    • Image Tools
    • Text & String Tools
    • Video Tools
    • Developer Tools
    • PDF Tools
    • Calculators & More
  • Prank Screens
  • Learn
  • Blog
  • Contact
Reading: How to Disable Binary Logging in MySQL or MariaDB
Share
Notification Show More
Font ResizerAa
How7oHow7o
Font ResizerAa
  • Tools
  • Prank Screens
  • Learn
  • Blog
Search
  • Home
  • Tools
    • All Tools
    • Image Tools
    • Text & String Tools
    • Video Tools
    • Developer Tools
    • PDF Tools
    • Calculators & More
  • 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.

You Might Also Like

Run a Linux cron job as a non-root user
Server Management

How to Run a Cron Job as a Non-Root User

5 Min Read
Install Node.js on Ubuntu — terminal with NodeSource setup_22.x curl command and Node.js hexagon icon
Web Development

How to Install Node.js on Ubuntu (22.04 & 24.04): Step-by-Step

11 Min Read
Delete all lines in Vim with :%d
Server Management

How to Delete All Lines in a File with Vi or Vim

4 Min Read
Reduce high memory usage on Windows 11
OS

How to Reduce High Memory Usage on Windows 11

7 Min Read
How7oHow7o

Free browser-based tools, prank screens, and step-by-step tech tutorials. No signup, nothing uploaded.

  • Private by design — your files never leave your device
  • Instant — no signup, no install, no waiting
  • Always free — no trials, no watermarks, no paywalls

Tools

  • PDF Editor
  • Image Upscaler
  • JPEG Compressor
  • Password Generator
  • QR Code Generator
  • Video Trimmer
  • See all tools →

Pranks

  • Cracked Screen Prank
  • Fake Blue Screen (BSOD)
  • Fake Disk Format
  • Fake Low Battery
  • Fake Nintendo Switch Update Screen
  • Fake PlayStation Update Screen
  • 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?