Databases
The database is where your site keeps its content, users and orders. If it crashes or refuses connections, most pages stop working at once. On WordPress this shows up as the famous “Error establishing a database connection”.
- At a glance
- Group
- Availability
- Mellonbot
- Can fix it
- What it does
- Restarts it and fixes common setting problems.
- Approval
- Always with your OK, or your access mode
What you’ll notice
- “Error establishing a database connection”
- Pages load without content, or checkout and logins fail
- Errors like “Too many connections” in your site’s logs
- The site is slow, then stops completely
Why it usually happens
- The server ran out of memory and the database was stopped
- The disk is full, so the database can’t write
- Too many visitors opened more connections than allowed
- A settings change or update stopped it from starting
Fix it yourself
How to fix it by hand
Comfortable with a terminal? Here’s what an experienced admin would do. Start with the read-only commands.
- 01
Check whether the database is running
Use mariadb, mysql or postgresql depending on what your site uses.
systemctl status mysql --no-pager - 02
Read its recent logs
Look for “out of memory”, “disk full” or configuration errors.
sudo journalctl -u mysql -n 50 --no-pager - 03
Check for memory kills
If the system killed the database to free memory, it’s logged here.
sudo journalctl -k | grep -i "killed process" - 04
Check free disk space
A full disk stops the database from saving anything.
df -h - 05
Restart the database
After fixing the cause, start it again and reload your site.
sudo systemctl restart mysql && systemctl is-active mysql
With Mellonbot
How Mellonbot fixes it
- Checks that your database is running and accepting connections.
- Finds out why it stopped — memory, disk or settings — and explains it plainly.
- Offers to restart it and fix common setting problems, with a backup and a 14-day undo.
- Emails you on scheduled checks if the database goes down or keeps restarting.
FAQ
Databases: common questions
How do I fix “Error establishing a database connection”?
First check the database is running. If it isn’t, its logs usually say why — often a lack of memory or disk space. If it is running, the login details in your site’s settings may be wrong.
Will restarting the database lose data?
A normal restart doesn’t lose saved data. Visitors in the middle of something may see an error for a few seconds.
Private alpha · invites in small waves
Let Mellonbot look after your server
Join the alpha with one email address. Early testers help shape Mellonbot and keep the founding-member perks after launch.
- No card needed
- Leave any time