How to Back Up Your FiveM Server (Files and Database)

Your FiveM server holds months of work — player characters, inventories, jobs, bans, staff permissions, and custom scripts. None of it is safe without a backup plan. A single bad resource update, a corrupted database migration, or a host incident can wipe everything. This guide covers every piece you need to protect: the MySQL/MariaDB database, the server-data folder, your resources, and the txAdmin profile — plus how to restore from each.

What You Actually Need to Back Up

A FiveM server stores its state in two completely different places. If you only back up one, you only half-survive a disaster.

ComponentWhat lives therePriority
MySQL / MariaDB databasePlayer characters, inventories, jobs, economy, bans, whitelistCritical
server-data/resources/All frameworks, scripts, and custom resourcesCritical
server-data/server.cfgStartup config, ensured resources, convars, license keyCritical
txAdmin txData/ profile foldertxAdmin config, admin accounts, scheduled restarts, player database (if not using MySQL)High
Purchased / compiled resourcesEscrow-locked scripts that can’t be re-downloaded after a host changeHigh

Folders you can safely skip: resources/[cache]/, any node_modules/ directory, .git/ directories inside resources, and FXServer binaries (re-download from the artifacts page any time).

Step 1 — Back Up the Database with mysqldump

Most roleplay frameworks (QBCore, ESX / es_extended, ox_core) store all live game state in MySQL or MariaDB. Your connection string in server.cfg — the mysql_connection_string convar used by oxmysql — tells you the database name. It looks like this:

set mysql_connection_string "mysql://dbuser:dbpass@localhost:3306/fivem?charset=utf8mb4"

The database name is the segment after the last / and before ? — in the example above, fivem. Your server may use a different name (common alternatives include es_extended, esxlegacy, or whatever you chose at setup).

Run the dump on the same machine as your database. The recommended command uses --single-transaction so InnoDB tables are captured in a consistent state without blocking player activity, and --lock-tables=false to avoid pausing writes on mixed-engine setups:

# Linux — replace values to match your setup
mysqldump -u dbuser -p'dbpass' \
  --single-transaction \
  --quick \
  --lock-tables=false \
  --routines \
  --triggers \
  fivem | gzip > /backups/fivem_db_$(date +%Y-%m-%d_%H%M).sql.gz

On newer MariaDB installs the binary may be named mariadb-dump instead of mysqldump — both accept the same flags. On Windows, provide the full path to the executable (for example C:\Program Files\MariaDB\bin\mysqldump.exe).

To automate this on Linux, add a cron job:

# crontab -e  — runs daily at 02:15 AM
15 2 * * * mysqldump -u dbuser -p'dbpass' --single-transaction --quick --lock-tables=false fivem | gzip > /backups/fivem_db_$(date +\%Y-\%m-\%d).sql.gz

Step 2 — Back Up the server-data Folder and Resources

Your server-data folder is the second critical half. It contains server.cfg and the resources/ directory with every fxmanifest.lua-based resource your server loads via ensure statements.

A clean tar archive on Linux, excluding cache and generated files:

tar -czf /backups/server-data_$(date +%Y-%m-%d_%H%M).tar.gz \
  --exclude='server-data/resources/[cache]' \
  --exclude='*/node_modules' \
  --exclude='*/.git' \
  /home/fxserver/server-data

Adjust the source path to match where your server-data directory actually lives. If your hosting panel (such as the XGamingServer FiveM panel) exposes a file manager, you can also download the folder as a ZIP directly from the web interface — useful for a quick pre-update snapshot.

Step 3 — Back Up the txAdmin Profile (txData)

txAdmin stores its own state — admin accounts, scheduled restart rules, server profile config, and its self-contained player database (used if you are not running MySQL) — in the txData folder. Historically the txDataPath convar controlled where this lives, but that convar is deprecated; current txAdmin builds use the TXHOST_DATA_PATH environment variable instead. By default the folder sits alongside your FXServer artifacts directory.

For a manual backup from within txAdmin, navigate to Settings → Master Actions → Make Database Backup. This covers txAdmin’s own SQLite player DB. For a complete profile backup, archive the entire txData/ directory alongside your server-data snapshot.

This is especially important before upgrading txAdmin or switching host providers, because admin accounts and scheduled-restart rules are stored here — not in server.cfg. See our guide on setting up automatic FiveM restarts for how those scheduled tasks are configured.

Step 4 — Restoring from a Backup

A backup you have never tested is an assumption, not a guarantee. Run a restore drill monthly, or before any major update. Here is the full restore sequence:

Restore the database

# Decompress first if gzipped
gunzip fivem_db_2026-06-11.sql.gz

# Restore into the database (must already exist)
mysql -u dbuser -p'dbpass' fivem < fivem_db_2026-06-11.sql

If you are on a fresh server, create the database first: CREATE DATABASE fivem CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; — then run the import command above.

Restore server-data files

tar -xzf server-data_2026-06-11_0215.tar.gz -C /home/fxserver/

Then restart FXServer. Verify that all expected resources load by checking the live console in txAdmin for any ensure errors. For help tracking down resource loading problems, see our FiveM resource loading errors guide.

Backup Schedule Recommendations

How often you back up depends on how much data you can afford to lose:

  • Active economy server (daily players): database every 4–6 hours, full file snapshot nightly.
  • Casual community server: database nightly, file snapshot before every major resource update.
  • Pre-update snapshot: always take a manual dump immediately before running a framework update (QBCore, ESX, ox_core) — even if your scheduled backup ran an hour ago.
  • Retention: keep at least 7 daily snapshots plus 4 weekly archives before pruning old files.

If you are running your server through a managed hosting panel, check whether automatic scheduled backups are already included with your plan — many providers run nightly snapshots at the infrastructure level. You can layer your own mysqldump cron on top for more granular database recovery points.

Want a fully managed environment where backups, uptime monitoring, and txAdmin come pre-configured? The XGamingServer FiveM documentation walks through panel setup, resource installation, and database configuration from day one.

Frequently Asked Questions

Do I need to stop my FiveM server before taking a backup?

For the database: no. The --single-transaction flag takes a consistent InnoDB snapshot while the server remains online, so players stay connected during the dump. For the files: it is not strictly required, but taking a file backup while the server is writing to disk (updating caches, generating logs) can occasionally result in partially written files. For the safest file snapshot, either pause the server briefly via txAdmin or schedule the tar backup to run during your lowest-traffic window.

Where should I store my FiveM backups?

Never only on the same server you are backing up. A host outage, filesystem corruption, or ransomware will take both the live data and the local backup at the same time. Store at least one copy offsite — options include an S3-compatible bucket (Backblaze B2, Cloudflare R2), SFTP to a second VPS, or automated sync to cloud storage via rclone. Local backups are still useful for fast same-day restores; treat offsite as your disaster-recovery copy.

My QBCore/ESX server uses a different database name — does the command change?

Only the database name argument changes. Check the mysql_connection_string convar in your server.cfg — the database name appears at the end of the connection URL (before any ? query parameters). Substitute that name wherever the examples above show fivem. Everything else — flags, gzip pipe, restore command — stays the same regardless of framework.

Ready to play?

Run your own FiveM server with XGamingServer

Spin up an always-on FiveM server your friends can join in minutes — no port-forwarding, no tech headaches.

99.9%Uptime SLA
< 5 minInstant setup
24/7Human support
DDoSProtected
Instant setup Your server is live in minutes with a one-click control panel.
Mods & plugins Install mods, plugins and workshop content in a few clicks.
DDoS protected Enterprise DDoS mitigation keeps your server online 24/7.
Low-latency hardware Premium CPUs & NVMe SSDs for lag-free multiplayer.
Free backups Automatic backups so your world is never lost.
Real human support Gamers helping gamers — 24/7, no bots, no scripts.

Pick your FiveM plan & play in minutes

See all plans
Starter $8.40/mo 4 GB RAM Renews $12/mo Buy now
Rookie $17.50/mo 8 GB RAM Renews $25/mo Buy now
Pro $24.50/mo 12 GB RAM Renews $35/mo Buy now