On this page
Binary logs are MariaDB’s record of every change to your databases. They support replication and point-in-time recovery, not day-to-day backups. On a VPS, if you turn them on and never set an expiry, the files keep growing until the disk is full and MariaDB stops. You free space by purging old logs on purpose, then set expiry so it does not happen again. On shared hosting this is handled for you; you will not see those files.
What the files look like
In the MariaDB data directory you will see names like mysql-bin.000123 plus a mysql-bin.index file. Each write to the database appends to the current binary log. A busy store can fill a small partition in days if expiry was never set. If you do not use replication or point-in-time recovery from binlogs, you may not need them on a small VPS at all. If you do need them, pair expiry with regular off-server dumps. Binary logs are a change stream; they are not a substitute for backups.
Free space safely, then set expiry
When the partition reaches 100%, InnoDB cannot write. Database connections hang, PHP shows database errors, and the site can look down even while the web server still answers. Purge with SQL such as PURGE BINARY LOGS BEFORE 'YYYY-MM-DD HH:MM:SS', or set expiry and let old files age out. Do not delete binary log files from the filesystem while MariaDB is running. Never remove ibdata1 or *.ibd files because they looked large; those hold table data.
Keep this from becoming next week’s ticket
On a VPS, set expiry when you enable binary logs, not after the disk alarm. A week is often enough when you already have JetBackup or a nightly dump. Point-in-time recovery only works from a known good dump plus the stream that follows it. If replication is why logs are on, confirm replicas have consumed the files before you purge on the primary. Checkout traffic, cron jobs, and apps that write to MySQL keep creating binlog entries, so expiry matters after you free space. On a VPS you own this setting; on shared hosting we rotate the logs. A bulk ALTER can also create a very large binlog spike; read charset conversion without mojibake before you change a large schema with binary logs enabled and little free disk.
Tagged
Was this article helpful?
Be the first to rate this article.



