FiveM database backup and restore

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:

  1. Connect to your server via SSH.
  2. Run the following command:
    mysqldump -u username -p databasename > backup.sql
  3. Enter your password when prompted.
  4. The file backup.sql now contains a full copy of your database.

Method 2: Backup via HeidiSQL

  1. Download and install HeidiSQL on your computer.
  2. Create a new connection using the database credentials from your server.cfg or panel settings.
  3. Select your database in the left panel.
  4. Go to Tools > Export database as SQL.
  5. 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:

  1. Open HeidiSQL and connect to your database.
  2. Go to File > Load SQL file and select your backup file.
  3. 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_vehicles and inventories.
  • 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.


Still stuck? Open a support ticket, our team is happy to help.

Back to the knowledge base