Technical Anshu
Tutorials Blog
🗄️ Automaattiset varmuuskopiot

Ajoita automaattiset tietokannan varmuuskopiot kaikille verkkosivustoillesi

Manuaalinen varmuuskopiointi tapahtuu päivinä, jotka muistat. Katastrofit valitsevat muut päivät. 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
🎥 Katso koko prosessi videolta – tietokannan joukkolataus vaihe vaiheelta

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. Tässä on tämän rutiinin muoto rehellisesti, mukaan lukien se osa, jonka kaikki unohtavat - tarkistaminen, että se toimii edelleen.

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
Todellinen rutiini on näin pieni. Use a dedicated backup user and a protected password file in production — the shape above is an example.
1

Rutiinin kolme osaa

  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

Ajoita se Cronin kanssa

Linux-palvelimella cron suorittaa skriptin aikataulussa: 30 2 * * * /usr/local/bin/backup-db.sh tarkoittaa 02:30 joka yö – valitse hiljainen hetki yleisöllesi. 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

Käytä 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

Osa, jonka kaikki ohittavat – sen katsominen ⭐

Ajastettu työ epäonnistuu äänettömästi sinä päivänä, jona levy täyttyy tai salasana vaihtuu, ja huomaat sen kuukausia myöhemmin. Lisää kaksi tapaa:

Automaatio ja satunnainen ihmisen katse tekevät siitä järjestelmän toivon sijaan.

5

Kuinka monta kopiota, missä

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.

🛡️ Vain omat verkkosivustosi. Jokainen tällä sivulla oleva menetelmä on tarkoitettu omistamiesi verkkosivustojen tietokantoihin tai verkkosivustoille, joita hallinnoit omistajan selkeällä luvalla – varmuuskopioita, siirtoja ja testausta. Tietokanta sisältää käyttäjiesi yksityiset tiedot; sellaisen lataaminen, johon sinulla ei ole oikeutta, on varastamista, mikä tahansa työkalu tekee sen helpoksi.

🎥 Katso koko video

Täysi joukkolatausprosessi - live-demo, jokaisessa vaiheessa ruudulla.

▶️ Watch Full Video
❓ Yleisiä kysymyksiä (FAQ)

Käytän jaettua isännöintiä ilman SSH:ta. Voinko silti automatisoida varmuuskopioinnin?

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

Mihin aikaan vuorokaudesta varmuuskopiointi pitäisi tehdä?

Hiljaisin liikennetuntisi – useimmille pienille sivustoille keskellä yötä yleisösi aikavyöhykkeellä. The export is gentle with --single-transaction, but there is no reason to run it at peak time.

Mistä tiedän, jos automaattinen varmuuskopiointi epäonnistuu?

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.

Tämä opas perustuu Technical Anshu -videoon, jossa käsitellään verkkosivustojen tietokantojen lataamista joukkona • Oletko jumissa askeleella? Kysy videon kommenteissa 🙏