Your FiveM database contains all important data: player information, vehicles, inventories and more. A proper backup prevents data loss during crashes, updates or server migrations.
Method 1: Backup via command line (mysqldump)
If you have SSH access to your server or VPS, you can use mysqldump:
- Connect to your server via SSH.
- Run the following command:
mysqldump -u username -p databasename > backup.sql - Enter your password when prompted.
- The file
backup.sqlnow contains a full copy of your database.
Method 2: Backup via HeidiSQL
- Download and install HeidiSQL on your computer.
- Create a new connection using the database credentials from your
server.cfgor panel settings. - Select your database in the left panel.
- Go to Tools > Export database as SQL.
- Select all tables, choose a save location and click Export.
Restoring a backup
To restore a backup:
Via command line:
mysql -u username -p databasename < backup.sql
Via HeidiSQL:
- Open HeidiSQL and connect to your database.
- Go to File > Load SQL file and select your backup file.
- Click Execute to import the backup.
Checking integrity
After restoring, it is wise to verify everything transferred correctly:
- Check the row count in important tables such as
users,owned_vehiclesandinventories. - Start the FiveM server and test whether player data loads correctly.
- Check the server console for database errors.
Tips
- Make regular backups, preferably daily or before every major change.
- Store backups in a different location than the server itself.
- Note the date and time with each backup, so you can always restore the right version.
Tip: at HostValues you can rent a FiveM server with database support.