How do I back up my FiveM server and database?
A complete FiveM backup includes the database, the resources folder, server.cfg and the txAdmin data folder. Dump the database daily with mysqldump or your panel's tool, archive the server files at least weekly and after every big change, and copy everything to storage that is not on the same machine. A backup only counts once you have restored it successfully on a test server.
What actually needs backing up
Most owners remember the database and forget the rest. A full restore needs all of these:
| Item | Why it matters | How often |
|---|---|---|
| Database | Characters, money, vehicles, houses, inventories | Daily, or more on busy servers |
resources folder | Your scripts, configs and custom edits | After every change, plus weekly |
server.cfg and other cfg files | Convars, ensure order, permissions | After every change |
| txAdmin data folder | Admins, bans, warnings, settings | Weekly |
| Keys and secrets | License key, Tebex secret, bot tokens | Store securely, separately |
Artifacts themselves do not need backing up. You can always download them again. See updating artifacts.
Step 1: Database dumps
On Linux with MariaDB, a simple daily dump looks like this:
mysqldump --single-transaction --routines -u backup -p'secret' fivem | gzip > /backups/db/fivem-$(date +%F).sql.gz
Schedule it with cron at a quiet hour:
0 5 * * * /home/fivem/scripts/db-backup.sh
On Windows, the same mysqldump tool ships with MariaDB and can be scheduled with Task Scheduler. Use a dedicated database user with read-only rights for backups, not your root account.
Step 2: File backups
Archive the server data folder, excluding caches:
tar --exclude='cache' -czf /backups/files/server-$(date +%F).tar.gz /home/fivem/txData
The cache folder is rebuilt automatically and only wastes space.
Step 3: Get it off the machine
A backup on the same disk as the server protects against mistakes, not against a dead disk, a cancelled VPS or a compromised box. Copy backups to:
- Object storage from a different provider
- A second server or home NAS
- At least one location your game server cannot delete from
The common 3-2-1 rule works well: three copies, two different media, one offsite.
Step 4: Retention
Keep daily database dumps for one to two weeks and weekly ones for a few months. Bugs and exploits are often discovered days after they happened, and you will want a dump from before the damage.
Step 5: Test the restore
Once a month:
- Spin up a test server.
- Import the latest dump and extract the files.
- Start the server and log in with a known character.
- Check money, inventory and vehicles look right.
If you have never restored a backup, you do not know whether you have one.
Before risky changes
Take a manual backup before:
- Framework or inventory migrations
- Large script updates
- Changing
sv_enforceGameBuild - Wiping or editing tables by hand
Checklist
- Daily database dumps
- File archives after changes and weekly
- Offsite copy that the game server cannot delete
- Retention policy set
- Restore tested this month
Backups also save you after an exploit. Pair them with good logging from cheater protection so you know which dump to roll back to.