Shortly before 1 a.m. one night this November, our monitoring system opened a high-priority ticket: “Service Down: MySQL” on a customer’s server. Every website on that server depended on the database, so each minute it stayed down meant pages showing “Error establishing a database connection”.
This post walks through that ticket: how it came in, how our engineer found the cause, what we asked the customer to do, and how the service came back. Then we cover how you can fix the same problem on your own VPS or dedicated server, and how to stop it happening again. We’ve removed the customer’s name, domain, server details and anything else that could identify them.
The ticket at a glance
- Alert: MySQL service down, detected automatically by our monitoring system
- First engineer response: about 15 minutes after the alert
- Root cause: the server’s disk was completely full
- Fix: the customer freed up disk space, and MySQL came back online
- Lesson: a full disk is one of the most common reasons MySQL stops, and it is almost always preventable
1. The alert comes in
Our monitoring checks key services on customer servers, including web, DNS and MySQL. When one stops responding, the system opens a support ticket automatically and emails the customer. In this case, the customer didn’t have to notice that their sites were down and write to us. The ticket was already in our queue.
Speed matters here. Many website owners first hear about a database outage from their own customers. An automatic alert gives the engineer a head start, often before most visitors notice.
2. The engineer confirms the problem
The first job is to confirm the alert is real. Not every “MySQL down” alert means a crash. MySQL may be running but closed to outside connections, or the server may not use MySQL at all. So the first checks are simple:
# Is the MySQL / MariaDB service actually running?
systemctl status mysqld # or: mysql / mariadb
# Is it listening on its port?
ss -ltnp | grep 3306
On this server, the service really had stopped. The next step is the one that matters most. Don’t restart MySQL until you’ve read the error log. A restart can hide the cause, and if the cause is still there, MySQL will simply fall over again.
# Typical log locations
tail -n 100 /var/log/mysqld.log
tail -n 100 /var/log/mysql/error.log
journalctl -u mysqld -u mariadb --since "1 hour ago" --no-pager
When a disk fills up, the MySQL log usually shows messages like Disk is full writing ... or Errcode: 28 "No space left on device". That points straight at storage.
3. Finding the cause: a full disk
One command confirms it:
df -h
The main partition, where MySQL keeps its data, was at 100%. When MySQL can’t write to disk, it can’t save data, create temporary tables or write its own logs, so it stops. That was the whole story here. MySQL itself was healthy; it had simply run out of room.
It’s worth checking inodes too. A disk can “fill up” by running out of inodes (the limit on how many files it can hold) while space still looks free:
df -i
4. The customer’s part: freeing up space
Within about 15 minutes of the alert, our engineer updated the ticket: the server’s disk space was full, and space needed to be freed from the customer’s side.
Why did the customer have to free the space rather than us? The files filling the disk were the customer’s own data: site files, backups, logs, databases. Only the owner knows which of them are safe to delete. Deleting the wrong backup or log to bring a service back is not a risk a hosting engineer should take on a customer’s behalf without clear instructions.
If you get a message like this, these are the places to look first:
# What's using the most space?
du -xh / --max-depth=2 2>/dev/null | sort -h | tail -n 25
# Inside the MySQL data directory
du -sh /var/lib/mysql/* | sort -h | tail -n 20
# Very large files anywhere on the main partition
find / -xdev -type f -size +500M -exec ls -lh {} \; 2>/dev/null
These are the usual culprits we see on full servers:
- Old backups on the same disk. Daily full backups that are never rotated are the most common cause. Move them off the server or delete old copies.
- MySQL binary logs (
mysql-bin.000123,binlog.000123). They pile up when nothing purges them. Remove old ones from inside MySQL withPURGE BINARY LOGS BEFORE NOW() - INTERVAL 3 DAY;. Never delete them withrm. - Log files under
/var/log, or an application’s own log that has grown out of control. - Cache, session or upload folders that grow forever, along with old site copies left behind after a migration.
5. MySQL comes back
Once there was free space on the disk, MySQL could start again, and our monitoring confirmed that the service was “up and working normally”. The ticket was updated automatically.
If you are fixing this yourself, start the service with your control panel’s method once space is free:
- cPanel/WHM: WHM → Restart Services → SQL Server, or
/scripts/restartsrv_mysql - DirectAdmin: Service Monitor, or
systemctl restart mysqld(ormariadb) - Plesk: Tools & Settings → Services Management, or
systemctl restart mariadb - Plain Linux:
systemctl restart mysqld,mysqlormariadb
Then watch the error log for a minute and run mysqlcheck --all-databases --check. A sudden stop on a full disk can occasionally leave a table that needs repair.
What we took away from this ticket
The fix took minutes once space was free. Most of the downtime was spent waiting for someone to clear space in the middle of the night. That’s the real lesson: a full disk gives plenty of warning. Disks rarely go from 70% to 100% in an hour. They fill up over days or weeks, and a simple alert would have caught this one long before MySQL stopped.
How to stop this happening on your server
- Alert on disk usage at 80%, not at 100%. Most control panels and monitoring tools can email you when a partition passes a threshold.
- Keep backups off the live disk. Store them on separate backup storage or a remote location, and rotate them automatically.
- Set binary log expiry with
binlog_expire_logs_seconds(MySQL 8) orexpire_logs_days(MariaDB / MySQL 5.7) if you don’t need long binlog history. - Rotate logs with
logrotate, including your application’s own logs. - Check disk growth monthly. If usage climbs steadily, plan a bigger disk before it becomes an outage.
When the disk isn’t the problem
A full disk is only one of the reasons MySQL goes down. If df -h shows plenty of space, these are the next things our engineers look at:
- Out of memory. If the server runs short of RAM, the Linux kernel kills the biggest process, usually MySQL. Check with
dmesg -T | grep -i "killed process". The fix is to tuneinnodb_buffer_pool_sizeand per-connection buffers to fit the RAM you have, reduce PHP/Apache workers, add swap, or move to a larger plan. - Crashed tables or InnoDB corruption after a hard crash or power loss. The error log will name the table. Take a full copy of
/var/lib/mysqlbefore attempting any repair orinnodb_force_recovery. - Too many connections. Slow queries or bot traffic can use up
max_connections. RunSHOW FULL PROCESSLIST;to see what’s piling up. - A false alarm. MySQL bound to
127.0.0.1or port 3306 closed in the firewall can make an outside check fail while your sites work fine. That’s a sensible security setting. Ask your host to monitor the service locally instead.
Need a hand?
If your server keeps running out of disk or memory, it’s usually time to tune it or give it more room. eWebGuru’s managed server services let our engineers take care of this kind of monitoring and cleanup for you. If you’ve outgrown your current setup, our VPS, cloud and dedicated servers give your databases space to grow. Talk to an engineer about what fits your workload.


