In short
A complete FiveM server backup has three parts: an SQL dump of the MariaDB/MySQL database (mysqldump), the resources folder plus server.cfg, and the txData folder that holds your txAdmin settings. Back up all three at the same time as date-stamped archives, keep at least one copy off the server, and test your restores regularly.
In this guide
Backing up a FiveM server takes more than copying one folder. Player characters, inventories, vehicles and bank accounts live in the database; your scripts and maps live in the resources folder; txAdmin admins, the ban list and scheduled restart settings live in the txData folder. If any one of these is missing, your restore will be incomplete. This guide walks you through backing up each part, automating the job, and getting the server back online after a wipe or an attack.
What do you need to back up?
| Component | Contents | How often? |
|---|---|---|
| Database (MariaDB/MySQL) | Characters, inventory, vehicles, housing and job data, bank accounts | At least daily on an active server; every few hours on a busy RP server |
| resources folder | Scripts, framework (ESX, QBCore, Qbox), stream files, MLOs | Before every change and weekly |
| server.cfg and extra .cfg files | ensure order, convars, ACE permissions, database connection string | Before every change |
| txData folder | txAdmin admins, player database and ban records, profile settings | Weekly and whenever txAdmin settings change |
Some folders you don't need to back up: the cache folder in the server root is rebuilt by FXServer and only bloats your archive. The artifact (the FXServer executables) can be re-downloaded from the official source instead of backed up; just write down which build you're running.
1. Database backup: SQL dump with mysqldump
The database is the most critical part, because everything your players spent hours building is stored there. Copying the database folder (for example, MariaDB's data directory) while the server is running produces an inconsistent backup. The right way is a logical dump with mysqldump. On InnoDB tables, the --single-transaction flag takes a consistent snapshot without stopping the server.
Linux
mysqldump -u fivem_user -p --single-transaction --routines --triggers \
--default-character-set=utf8mb4 fivem_db > fivem_db_$(date +%F_%H%M).sqlWindows
Use mysqldump.exe from the bin folder of your MariaDB install (adjust the path to match your setup):
"C:\Program Files\MariaDB 11.4\bin\mysqldump.exe" -u fivem_user -p --single-transaction --routines --triggers --default-character-set=utf8mb4 fivem_db > D:\yedek\fivem_db.sqlIf you don't know the database name or user, check the mysql_connection_string line in server.cfg. We cover the oxmysql setup and the format of that line in detail in our oxmysql and MariaDB database setup guide.
For automated jobs, don't put the password on the command line; use an option file that only you can read. On Linux, create ~/.my.cnf and set its permissions to 600:
[mysqldump]
user=fivem_user
password=GucluBirSifre2. Backing up resources, server.cfg and txData
The easiest way to handle the file side is a single compressed archive. The example below assumes your server files are in /home/fivem/server-data and your txData folder is in /home/fivem/txData:
tar -czf /home/fivem/yedek/dosyalar_$(date +%F_%H%M).tar.gz \
--exclude='server-data/cache' \
-C /home/fivem server-data txDataOn Windows, you can do the same with the built-in tar command or with PowerShell:
Compress-Archive -Path C:\FXServer\server-data\resources, C:\FXServer\server-data\server.cfg, C:\FXServer\txData -DestinationPath D:\yedek\dosyalar.ziptxData also contains txAdmin's own player and ban database, so skipping this folder means losing your ban list and admin accounts after a restore.
3. Automated scheduling and retention
A manual backup is useless the day you forget to run it. Combine both parts into one script and schedule it.
Linux: daily backups with cron
#!/bin/bash
set -e
HEDEF=/home/fivem/yedek
TARIH=$(date +%F_%H%M)
mysqldump --single-transaction --routines --triggers fivem_db | gzip > $HEDEF/db_$TARIH.sql.gz
tar -czf $HEDEF/dosyalar_$TARIH.tar.gz --exclude='server-data/cache' -C /home/fivem server-data txData
find $HEDEF -type f -mtime +14 -deleteSave the script as /home/fivem/yedekle.sh, make it executable with chmod +x, and use crontab -e to run it every night at 4:30 AM:
30 4 * * * /home/fivem/yedekle.sh >> /home/fivem/yedek/yedek.log 2>&1The find command on the last line deletes backups older than 14 days; tune the retention period to your server's size so the disk doesn't fill up.
Windows: Task Scheduler
Put the commands above into a yedekle.bat file and attach it to a daily trigger in Task Scheduler using “Create Basic Task.” Be sure to save the task with the “Run whether user is logged on or not” option.
The 3-2-1 rule
- 3 copies: your live data plus two backups.
- 2 different media: the server disk and separate storage.
- 1 copy off the server: if the server is compromised or the disk fails, only this copy will save you. On Linux, tools like
rclonecan sync your archives to external storage.
Local backups need disk space. Once daily SQL dumps and weekly file archives pile up, a 40 GB disk fills quickly. For a mid-sized RP server, the OB-FIVEM-3 FiveM server plan with 4 CPU cores, 6 GB DDR5 RAM and 60 GB NVMe is a good starting point for keeping several days of local backups alongside your game files.
4. Restore scenarios
Scenario A: Planned wipe or a bad update
You reset the economy and players pushed back, or a new script corrupted the database. In this case, you only need to restore the database:
- Stop the server from txAdmin; never restore while players are connected.
- Back up the current state too, in case you want to roll back.
- Drop the database and import the backup:
mysql -u fivem_user -p -e "DROP DATABASE fivem_db; CREATE DATABASE fivem_db CHARACTER SET utf8mb4;"
gunzip < db_2026-12-01_0430.sql.gz | mysql -u fivem_user -p fivem_db- Start the server and check inventory, vehicles and money with a few test characters.
Scenario B: Hack, backdoor or unauthorized access
If players were handed unlimited money, admins were changed, or you see unfamiliar commands in the server console, the cause may be a backdoor in a script. Scripts from unknown sources are the biggest risk; we cover this in detail in the risks of using leaked FiveM scripts. Follow this order:
- Shut down the server and use the logs to find when the attack started.
- Change every password: the database user, txAdmin admins, server access credentials and Discord webhooks. Regenerate your server license key in the Cfx.re portal.
- Pick a database backup from before the attack. If the attack went unnoticed for days, you may need to go back further, which is why you shouldn't keep a short retention period.
- Don't restore the resources folder from backup as-is. The backdoor may be in the backup too. Re-download scripts from their official sources, and scan custom scripts for
PerformHttpRequest,load(and obfuscated lines full of meaningless character strings. - Run the cleaned setup in a closed test environment first, then put it live.
Scenario C: Migrating servers
When you move to a new server, the same backups act as your migration package: import the SQL dump into the new database, extract the file archive, and update the connection string in server.cfg with the new database credentials. Keep the artifact build the same as on the old server; upgrade it as a separate step after the migration is done. See our FiveM artifact update guide for that.
Verifying that your backup actually works
A backup only proves its value when you restore it. Run this quick test once a month:
- Create a separate test database, for example
fivem_test. - Import the latest SQL dump into it:
gunzip < db_SON.sql.gz | mysql -u fivem_user -p fivem_test - Compare the table count and the row counts of a few critical tables with the live database:
SELECT table_name, table_rows
FROM information_schema.tables
WHERE table_schema = 'fivem_test'
ORDER BY table_rows DESC
LIMIT 10;- Extract the file archive to a temporary folder and confirm that
resources,server.cfgandtxDatacame through complete. - Drop the test database. Record the result and the date in your backup log.
Row counts in information_schema are estimates on InnoDB; they're good enough to catch large gaps. For an exact check, use SELECT COUNT(*) on the important tables.
Keeping backup size small
The tables that grow fastest are usually log tables: scripts that record every money transfer, every inventory move or every connection bloat the database much faster than player data does. Regularly archiving and deleting old rows from these tables shrinks your backups and speeds up restores. Compressing SQL dumps with gzip also cuts disk usage significantly, since dumps are plain text. If your backup folder sits on the same disk as your server files, check disk usage weekly; a full disk means neither the backup nor the live database can write.
Common backup mistakes
- Never testing the backup: Restore a backup to a test environment once a month. A backup that won't open isn't a backup.
- Storing it only on the server disk: If an attacker gets into the server, they can delete your backups too.
- Copying the database folder while it's live: This produces inconsistent files; always use mysqldump.
- Hardcoding the password in the script: Use an option file and restrict its permissions.
Next step
A backup routine is only as solid as the server it runs on. OyunBulut FiveM servers run in our Istanbul data center with NVMe disks, DDoS protection and automatic setup; pick a plan with enough disk for local backups and you can set up the script above on day one. Compare every size on the FiveM server plans page, or start a mid-sized RP right away with the OB-FIVEM-3 plan. If you get stuck during setup or a restore, open a support ticket and we'll help.
Frequently asked questions
Which files should a FiveM server backup include?
A complete backup includes an SQL dump of the MariaDB/MySQL database, the resources folder, server.cfg and any extra .cfg files, and txAdmin's txData folder. The cache folder is rebuilt automatically, so you don't need to back it up.
Can I back up the database while the server is running?
Yes. If you run mysqldump with the --single-transaction flag on InnoDB tables, you get a consistent dump without stopping the server. Restores, however, should be done with the server stopped.
How often should I back up my FiveM server?
On an active roleplay server, back up the database at least daily, and every few hours on busy servers. File backups can be taken before every major change and weekly.
Is it safe to restore the resources folder from backup after a hack?
Not always, because the script containing the backdoor may also be in the backup. Restore the database from a backup taken before the attack, and re-download scripts from their official sources and scan them for suspicious code.
What do I lose if I don't back up the txData folder?
You lose txAdmin admin accounts, ban and warning records, player notes, and profile settings such as scheduled restarts. Game data survives because it lives in the database, but you'll have to rebuild the admin side from scratch.