How to Back Up Your FiveM Server
Back up your FiveM server files, server.cfg, license key location and database, then test the restore. Manual and scheduled methods explained.
Short answer
Back up three things: your server folder (resources, server.cfg and txAdmin's txData folder), your database, and a note of where your license key comes from. Store the copies off the server machine, run them on a schedule, and restore one to a test folder at least once so you know it works.
What to back up
- Server folder: the folder you run FXServer from, including your
resourcesfolder and any custom files. Back up the whole folder rather than picking files, because the sources do not list every file the server needs. - server.cfg: the startup config. See FiveM server.cfg explained.
- txData folder: txAdmin saves its profiles inside
txData. The txAdmin docs say its location is set by thetxDataPathconvar, and the default differs by OS, so find yours before you back up. - Database: the MySQL or MariaDB database your scripts use, such as one used by oxmysql. The txAdmin docs say its own player database needs no MySQL, so the script database is separate and needs its own dump. See install MariaDB for FiveM.
- License key location: community forum posts say the key is issued through Cfx.re keymaster and set in
server.cfgassv_licenseKey. Keep the key in a password manager, not in a backup file that others can read. See FiveM license key on the Cfx.re Portal.
How often to back up
No source we checked sets a schedule. Our recommendation: dump the database daily, because player and script data change constantly. Copy the full server folder before every update, resource install or txAdmin change. Keep several days of copies so you can go back past a bad change.
Manual backup methods
txAdmin backup tool. The txAdmin docs describe a self-contained player database with a backup tool. They do not say that tool backs up your files, resources or script database, so treat it as one part of a backup. During setup, txAdmin asks you to set a backup password (Cfx.re setup docs).
File copy. Stop the server first so files are not copied mid-write. Then archive the folder. Replace the placeholder paths with your own:
tar -czf /path/to/backups/server-$(date +%F).tar.gz -C /path/to/server-parent server-folder
Database dump. MariaDB documents mariadb-dump as a logical backup tool that suits smaller datasets. The --single-transaction flag takes a consistent snapshot of InnoDB tables. --routines and --events add stored procedures, functions and scheduled events to the dump (mariadb-dump reference).
mariadb-dump --single-transaction --routines --events -u DB_USER -p DB_NAME > /path/to/backups/db-$(date +%F).sql
The -p flag prompts for DB_PASSWORD, so the password is not stored in the command or your shell history.
Scheduled backups
On Linux, cron can run the same commands automatically. Put the database credentials in a protected option file with restricted permissions, not directly in the crontab. This example runs a script at 04:00 every day, with placeholder paths:
0 4 * * * /path/to/backup-script.sh >> /path/to/backups/backup.log 2>&1
On Windows, Task Scheduler can run the same archive and dump commands. Delete old copies on a schedule so the disk does not fill up, and move copies to a second machine or storage service. These setup steps are our recommendation, not from a source.
How to restore and test
- Copy the archive and dump to a test machine or a separate folder. Never restore over your live server first.
- Extract the files:
tar -xzf /path/to/backups/server-YYYY-MM-DD.tar.gz -C /path/to/test-folder - Import the database with the
mariadbclient, as MariaDB documents formariadb-dumpfiles:
mariadb -u DB_USER -p DB_NAME < /path/to/backups/db-YYYY-MM-DD.sql
MariaDB warns that a full dump drops and recreates existing tables with the same names, so data written after the backup is lost. Check which database you are restoring into (restoring data from dump files).
- Start the test server and check that every resource starts without errors and that a test player can join. MariaDB recommends restoring backups to a non-production environment on a regular basis (MariaDB backup guide).
Common mistakes
- Backing up only the files or only the database. Either one alone cannot rebuild the server.
- Keeping every copy on the server's own disk. A disk failure or a hacked machine takes the backups with it.
- Never testing a restore. A backup file that exists is not proof that it works.
- Leaving out
--routinesand--events. Stored procedures and scheduled events are then missing after restore. - Copying files while the server runs. This can produce half-written files.
- Putting the real license key or password in a script or shared file. Use placeholders in docs and keep secrets in a protected file.
FAQ
Is the txAdmin backup enough on its own?
No. The txAdmin docs confirm a player database backup tool. They do not say it covers your resources, server.cfg or script database, so back those up separately.
Does my database need its own backup?
Yes, if your scripts use MySQL or MariaDB. The txAdmin docs say its player database needs no MySQL, so your script database is separate. Dump it with mariadb-dump as shown above.
How often should I back up?
The sources we checked do not set a schedule. We recommend a daily database dump, a full copy before each change, and several days of copies kept off the server.
Sources
- txAdmin - Cfx Documentation
- Setting up a FiveM Server - Cfx Documentation
- mariadb-dump reference - MariaDB Knowledge Base
- Restoring Data from Dump Files - MariaDB Knowledge Base
- Making Backups with mariadb-dump - MariaDB Documentation
- sv_licenseKey - Cfx Forum (community)
Last checked: 29 November 2026
Not confirmed: whether txAdmin's backup tool covers full server files, resources or the script database; any official backup schedule; how license keys are recovered on the Cfx.re Portal; and whether the forum posts on sv_licenseKey match the current setup, since the official setup page refers to a "server registration key" instead.
FiveM.tools was founded with sponsorship from Nyru.