Technical Anshu
Tutorials Blog
🗄️ Automatic Backups

Schedule Automatic Database Backups for All Your Websites

Manual backups happen on the days you remember. Disasters pick the other days. A small scheduled script quietly downloads every database, every night, and keeps the last few copies — that is the real 'bulk and fast'.

✍️ Technical Anshu🗄️ MySQL / MariaDB⏱️ Backup Guide
🎥 Watch the full process in the video — bulk database download, step by step

If you run several websites, the bulk download problem solves itself once it is scheduled: a script on the server exports all databases with mysqldump, compresses them, rotates old copies away, and a copy leaves the server. Here is the shape of that routine, honestly, including the part everyone forgets — checking it still works.

A backup script and its schedule, in plain form
#!/bin/bash mysqldump -u backup -p'SECRET' --all-databases --single-transaction --quick | gzip > /backups/db-$(date +%F).sql.gz find /backups -name "db-*.sql.gz" -mtime +14 -delete # crontab - run daily at 02:30 30 2 * * * /usr/local/bin/backup-db.sh
A real routine is this small. Use a dedicated backup user and a protected password file in production — the shape above is an example.
1

The Three Pieces of the Routine

  1. Export: one mysqldump command with --all-databases --single-transaction --quick, piped through gzip, with the date in the filename.
  2. Rotate: delete copies older than your chosen window (14 days of dailies is a sane start) so the disk never fills.
  3. Move: copy the file off the server — to another server, your office NAS, or protected cloud storage. A backup that lives only on the machine it protects is lost in the same fire.
2

Schedule It with Cron

On a Linux server, cron runs the script on schedule: 30 2 * * * /usr/local/bin/backup-db.sh means 02:30 every night — pick a quiet hour for your audience. On shared hosting without cron or SSH, a reputable backup plugin with scheduling is the honest substitute, and some panels offer their own scheduled backup jobs.

3

Use a Dedicated Backup User

Do not put your root database password in a script that other processes can read. Create a MySQL user just for backups with read-and-lock privileges on the databases (SELECT, LOCK TABLES, SHOW VIEW, TRIGGER, EVENT as your setup needs) and store its credentials in a file only the backup account can read. If the script ever leaks, the damage is limited to reading backups — bad enough, so protect the script too.

4

The Part Everyone Skips — Watching It ⭐

A scheduled job fails silently the day the disk fills or a password changes, and you find out months later. Add two habits:

Automation plus an occasional human glance is what makes it a system instead of a hope.

5

How Many Copies, Where

A simple, defensible pattern for small fleets: nightly copies kept 14 days on the server, the newest copied off-server, plus one monthly copy kept longer. Adjust the numbers to your sites' change rate and storage — the principle matters more than the exact count: recent, rotated, and one copy somewhere else.

🛡️ Your own websites only. Every method on this page is for databases of websites you own, or websites you administer with the owner's clear permission — backups, migrations and testing. A database holds your users' private data; downloading one you have no right to is theft, whatever tool makes it easy.

🎥 Watch the Complete Video

The full bulk database download process — live demo, every step on screen.

▶️ Watch Full Video
❓ Common Questions (FAQ)

I am on shared hosting without SSH. Can I still automate backups?

Often yes — many panels include scheduled backup jobs, and WordPress backup plugins can schedule database backups and send them to cloud storage. The tool differs; the routine (export, rotate, off-site copy, check) is the same.

What time of day should backups run?

Your quietest traffic hour — for most small sites, the middle of the night in your audience's timezone. The export is gentle with --single-transaction, but there is no reason to run it at peak time.

How will I know if the automatic backup fails?

Only if you arrange to know: log every run, alert on failure, and eyeball the log regularly. An unmonitored schedule fails silently — checking occasionally is part of the system, not an extra.

This guide is based on the Technical Anshu video on downloading website databases in bulk • Stuck on a step? Ask in the video comments 🙏