---
title: "How to migrate a FiveM server to a VPS | StreetHosting"
description: "Move your FiveM server to a VPS: files, mysqldump database export, oxmysql, Cfx.re key on the new IP, txAdmin, firewall and DNS, without losing characters."
url: "https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps"
type: "page"
language: "en-US"
---

VPS · 10 min · Advanced

Published on Sep 28, 2026 · Updated on Sep 28, 2026

# Move your FiveM server to a VPS without losing a single character

A roleplay server is made of files, a database, txAdmin data and a key tied to an IP. This guide shows how to move each piece to the VPS, test it first and switch the address without players losing progress.

By [Equipe StreetHosting](https://streethosting.com.br/en/autores#equipe-streethosting) · StreetHosting infrastructure and support team

[Other games](https://streethosting.com.br/en/guides/topics/other-games) [Migration](https://streethosting.com.br/en/guides/topics/migration)

Summarize with:

[](https://chat.openai.com/?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fmigrate-fivem-server-to-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "ChatGPT") [](https://claude.ai/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fmigrate-fivem-server-to-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Claude") [](https://www.google.com/search?udm=50&aep=11&q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fmigrate-fivem-server-to-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Google AI Mode") [](https://x.com/i/grok?text=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fmigrate-fivem-server-to-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Grok") [](https://www.perplexity.ai/search/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fmigrate-fivem-server-to-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Perplexity")

Share:

[](https://x.com/intent/tweet?text=How%20to%20migrate%20a%20FiveM%20server%20to%20a%20VPS&url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fmigrate-fivem-server-to-vps "Share on X") [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fmigrate-fivem-server-to-vps "Share on Facebook") [](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fmigrate-fivem-server-to-vps "Share on LinkedIn") [](https://wa.me/?text=How%20to%20migrate%20a%20FiveM%20server%20to%20a%20VPS%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fmigrate-fivem-server-to-vps "Share on WhatsApp")

For agents: Copy as Markdown [.md](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps.md)

In this guide 8 sections

* [What makes up a FiveM server](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#o-que-migrar)
* [Prepare the VPS](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#preparar-vps)
* [Export and import the database](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#banco-de-dados)
* [Copy the server folder and txData](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#arquivos-e-txadmin)
* [The Cfx.re license key](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#chave-cfx)
* [Firewall: what to open and what to close](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#firewall)
* [Testing, cutover and DNS](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#teste-e-virada)
* [Which VPS to pick for your server](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#qual-vps)

Quick answer

To **migrate a FiveM server to a VPS**, install the Linux FXServer artifact, copy the server folder and the txData folder, export the database with mysqldump and import it into MariaDB on the VPS, update the oxmysql connection string and rebind the Cfx.re key to the new IP. Open 30120 on TCP and UDP, restrict txAdmin's 40120 to the staff IP and only switch DNS after testing the server through the VPS IP.

## What makes up a FiveM server[](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#o-que-migrar)

A roleplay server is not a single folder. It is several pieces living in different places, and forgetting any one of them is expensive. Without the database, every character goes back to zero. Without txData, the staff loses access to the panel and the ban history disappears. If you do not rebind the key, the server does not register with Cfx.re. Before copying any file, take the inventory below.

| Piece              | Where it lives                                           | How to move it                                                                       |
| ------------------ | -------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| FXServer artifacts | Folder with run.sh on Linux or FXServer.exe on Windows   | Do not copy it: download the Linux artifact on the same build or the recommended one |
| Server folder      | resources, server.cfg, stream files and script configs   | Compress and send over rsync or SFTP                                                 |
| Database           | MySQL or MariaDB on the old server                       | Dump with mysqldump and import into MariaDB on the VPS                               |
| txData             | txAdmin folder with admins, schedules and player history | Copy it whole, with the server stopped                                               |
| Cfx.re key         | sv\_licenseKey line in server.cfg                        | Rebind to the new IP in the Cfx.re Portal                                            |
| Address            | IP, domain and connect link posted on Discord            | A record with a low TTL and a test before the switch                                 |

If the server runs on Windows today, moving to a Linux VPS brings three extra things to watch that usually only show up on the first boot:

* **Upper and lower case:** on Linux, `Client/main.lua` and `client/main.lua` are different files. A path in fxmanifest.lua that Windows accepted can break the whole resource.
* **Absolute paths:** lines like `exec C:\FXServer\server-data\config.cfg` need to become paths relative to the server folder.
* **Windows binaries:** resources that ship .dll or .exe files do not run on Linux. Ask the author for a Linux version or replace the script before the migration, not during it.

## Prepare the VPS[](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#preparar-vps)

Use Ubuntu 24.04 LTS, log in over SSH with a key and create a dedicated user for FiveM. The game process must never run as root: if a compromised resource gains full power, the whole VPS goes with it. The detailed database install, with security hardening, is in [installing MariaDB or MySQL on an Ubuntu VPS](https://streethosting.com.br/en/guides/vps/install-mariadb-mysql-ubuntu-vps).

`sudo apt update && sudo apt upgrade -y sudo apt install -y xz-utils mariadb-server rsync unzip sudo mariadb-secure-installation sudo adduser --disabled-password --gecos "" fivem sudo -iu fivem mkdir -p ~/fxserver ~/cidade && cd ~/fxserver wget -O fx.tar.xz "URL_DO_ARTEFATO_LINUX" tar xf fx.tar.xz && rm fx.tar.xz`

The artifact URL comes from the official Cfx.re Linux artifacts page. Install the same build the old server runs, which shows up in the console and on the txAdmin start screen, or the build recommended at the moment. Changing builds at the same time as changing machines mixes two changes together and makes it impossible to tell which one caused an error.

Write down the current build, the database version and the list of active resources before shutting anything down. That three line note answers half the questions that come up on cutover night.

## Export and import the database[](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#banco-de-dados)

The database holds characters, inventories, vehicles, houses, money and jobs. It is the piece that hurts most to lose and the one that suffers most from a sloppy copy. On the old machine, with the server stopped, generate the dump:

`mysqldump -u root -p --single-transaction --routines --triggers \ --default-character-set=utf8mb4 nome_do_banco > cidade.sql gzip cidade.sql`

The single transaction option produces a consistent snapshot of the tables, and utf8mb4 preserves accents and emojis in character names. If the old server is a plan with a panel and no SSH, export through phpMyAdmin in SQL format, which gets you the same result.

On the VPS, create the database and a dedicated user for the server:

`sudo mariadb CREATE DATABASE cidade CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'SENHA_FORTE'; GRANT ALL PRIVILEGES ON cidade.* TO 'fivem'@'localhost'; FLUSH PRIVILEGES; EXIT; gunzip cidade.sql.gz mariadb -u fivem -p cidade < cidade.sql`

Verify the import by comparing the row counts of the main tables on both sides, for example `SELECT COUNT(*) FROM users;` on ESX databases or the `players` table on QBCore databases. Matching numbers are the minimum before moving on.

Finally, point oxmysql at the new database in server.cfg. The `ensure oxmysql` line needs to come before the resources that use the database.

`set mysql_connection_string "mysql://fivem:SENHA_FORTE@127.0.0.1:3306/cidade?charset=utf8mb4"`

Always use **set** on this line, never setr. setr replicates the variable to the clients, and any connected player could read the database password. Also avoid the characters `; , / ? : @ & = + $ #` in the password, because they break the parsing of the connection string.

## Copy the server folder and txData[](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#arquivos-e-txadmin)

Stop the server through txAdmin before copying, so no file gets written in the middle of the transfer. If the old server is also Linux with SSH, rsync carries everything and lets you repeat the copy later, sending only what changed:

`rsync -aHz --info=progress2 usuario@IP_ANTIGO:/caminho/da/cidade/ /home/fivem/cidade/ rsync -aHz --info=progress2 usuario@IP_ANTIGO:/caminho/do/txData/ /home/fivem/txData/`

Coming from Windows, zip the server folder and txData and send them over SFTP or scp. Both methods are explained in [transferring files to the VPS with SCP and rsync](https://streethosting.com.br/en/guides/vps/transfer-files-to-vps-scp-rsync). In installs created through a txAdmin recipe, the server folder usually sits inside txData itself, with a name ending in .base.

txData holds the admin accounts, the restart schedules, the txAdmin settings and the player database with warnings and bans. On Linux, by default, it sits next to run.sh. To avoid depending on that, pin the path with the `TXHOST_DATA_PATH` variable in the systemd service, at `/etc/systemd/system/fivem.service`:

`[Unit] Description=FXServer com txAdmin After=network-online.target mariadb.service Wants=network-online.target [Service] User=fivem WorkingDirectory=/home/fivem/fxserver Environment=TXHOST_DATA_PATH=/home/fivem/txData ExecStart=/home/fivem/fxserver/run.sh Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target`

Enable it with `sudo systemctl daemon-reload && sudo systemctl enable --now fivem` and follow the boot with `journalctl -u fivem -f`. On the first txAdmin login, the FXServer settings still point to the paths of the old machine. Fix the server data folder to `/home/fivem/cidade` and the server.cfg path, and review the file before starting:

* endpoint\_add\_tcp and endpoint\_add\_udp listening on 0.0.0.0:30120
* sv\_licenseKey with the key already rebound to the VPS IP
* mysql\_connection\_string pointing to 127.0.0.1 and the new database
* No absolute paths inherited from Windows in the exec lines
* Webhooks, APIs and stores that allow access by IP updated

## The Cfx.re license key[](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#chave-cfx)

Every public FiveM server needs a Cfx.re registration key on the `sv_licenseKey` line. The key is tied to the public IP that first used it. Carrying server.cfg over to the VPS without touching it is the most common reason a migrated server boots but does not register properly.

Key management moved out of the old Keymaster and now lives in the Cfx.re Portal, at portal.cfx.re. There you find the server and have two paths: rebind the current key to the new IP, which takes effect on the next boot, or generate a new key and swap the line in server.cfg. The portal interface changes fairly often, so if the button is not where you expect, the Cfx.re support center describes the current step.

The key is a credential. If it has shown up in a screenshot, an open chat or a public repository, generate a new one during the migration. And never push the full server.cfg to a public repository: it carries the key and the database password.

If the community joins through the Cfx.re short link, test that link after the cutover before reposting it on Discord. It is tied to the server registration, and changing the key can produce a new address.

## Firewall: what to open and what to close[](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#firewall)

On the new VPS you decide what stays exposed. The rule is simple: only the game port open to everyone, the panel restricted to the staff and the database invisible to the internet.

| Port  | Protocol    | Service                         | Rule                                             |
| ----- | ----------- | ------------------------------- | ------------------------------------------------ |
| 22    | TCP         | SSH                             | Open, with login by key only                     |
| 30120 | TCP and UDP | FXServer, where players come in | Open to everyone                                 |
| 40120 | TCP         | txAdmin panel                   | Staff IP only or through an SSH tunnel           |
| 3306  | TCP         | MariaDB                         | Closed, with the database listening on localhost |

`sudo ufw default deny incoming sudo ufw allow OpenSSH sudo ufw allow 30120/tcp sudo ufw allow 30120/udp sudo ufw allow from IP_DA_STAFF to any port 40120 proto tcp sudo ufw enable`

If the staff has no fixed IP, leave 40120 closed and use an SSH tunnel: run `ssh -L 40120:127.0.0.1:40120 usuario@IP_DA_VPS` on your computer and open http://localhost:40120 in the browser. The edge Anti-DDoS holds off volumetric attacks, but the firewall on the VPS itself is what defines what stays exposed. The firewall rules are covered in [UFW firewall on an Ubuntu VPS](https://streethosting.com.br/en/guides/vps/ufw-firewall-ubuntu-vps).

## Testing, cutover and DNS[](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#teste-e-virada)

The new server needs a real test before it receives any player. With everything in place, follow this order:

1. Bring the server up on the VPS and have the staff join through the F8 console using `connect IP_DA_VPS:30120`.
2. Test everything that touches the database: log in with an old character, open the inventory, pull a vehicle out of the garage, withdraw money, clock in at a job and enter a purchased house.
3. At least 24 hours before the cutover, lower the TTL of the domain's A record to 300 seconds.
4. In the scheduled window, stop the old server, generate the final dump, import it on the VPS and run rsync again to bring over what changed in the server folder and in txData.
5. Point the A record at the VPS IP. Anyone joining through `connect cidade.seudominio.com.br` lands on the new machine as soon as the TTL expires.
6. Watch the first peak hour in txAdmin, keeping an eye on tick, memory and console errors.
7. Keep the old server off, but intact, for a few days. It is your way back.

Anyone still advertising the numeric IP needs to announce the new address ahead of time, because only the domain changes destination on its own. The human side of the migration, with a schedule of Discord announcements, choosing the window and criteria for rolling back, is in [how to migrate a game server without losing players](https://streethosting.com.br/en/guides/infrastructure/migrate-game-server-without-losing-players).

Do not use the migration as an excuse to update the base, switch frameworks or clean up resources. Migrate as is, stabilize for a week and only then start making changes. That way every problem has a single cause.

## Which VPS to pick for your server[](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#qual-vps)

FiveM concentrates the resource logic on one main thread, so per core performance matters more than core count. That is why the [Ryzen VPS](https://streethosting.com.br/en/vps/ryzen) line, with a Ryzen 9 9950X at up to 5.7 GHz, DDR5 memory and NVMe, is the recommended one. Memory depends on scripts, MLOs and added vehicles, and on the VPS it is shared between FXServer, MariaDB and the system.

* **4 vCPU, 8 GB DDR5 and 80 GB NVMe, R$ 118.00 per month:** server with up to 32 players and the database on the same machine.
* **6 vCPU, 16 GB DDR5 and 160 GB NVMe, R$ 222.00 per month:** full server at prime time, with many MLOs and added cars.
* **10 vCPU, 32 GB DDR5 and 320 GB NVMe, R$ 430.00 per month:** large server plus a test server, website and bot on the same VPS.

All of them are in São Paulo, with Anti-DDoS included, root access and activation within 60 seconds, which lets you spin up the new VPS days ahead and rehearse calmly. If the server grows, the upgrade is done through the control panel, charges only the prorated difference for the cycle and requires a VM reboot. The memory math per server profile is in [how much RAM a FiveM server needs](https://streethosting.com.br/en/guides/vps/how-much-ram-does-a-fivem-server-need).

If the team does not need root and would rather not manage an operating system, the ready-made plans of our [FiveM hosting](https://streethosting.com.br/en/fivem) go from R$ 80.00 per month, with 2 GB and up to 20 players, to R$ 370.00, with 13 GB and 150 to 200 players. And when not even the largest VPS is enough, the signs that it is time for exclusive hardware are in [VPS or dedicated server for FiveM](https://streethosting.com.br/en/guides/vps/dedicated-server-vs-vps-for-fivem).

In this guide

* [What makes up a FiveM server](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#o-que-migrar)
* [Prepare the VPS](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#preparar-vps)
* [Export and import the database](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#banco-de-dados)
* [Copy the server folder and txData](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#arquivos-e-txadmin)
* [The Cfx.re license key](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#chave-cfx)
* [Firewall: what to open and what to close](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#firewall)
* [Testing, cutover and DNS](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#teste-e-virada)
* [Which VPS to pick for your server](https://streethosting.com.br/en/guides/vps/migrate-fivem-server-to-vps#qual-vps)

## Frequently asked questions

Do I need to generate a new FiveM key when changing servers?

The key is tied to the public IP that first used it. When moving to the VPS, rebind the key to the new IP in the Cfx.re Portal or generate another one and swap the sv\_licenseKey line in server.cfg. If the old key has ever shown up in a screenshot or a repository, generate a new one regardless.

How do I move the FiveM server database to the VPS?

Export the database with mysqldump, with the server stopped and using utf8mb4, and import it into MariaDB on the VPS in a database created with the same character set. Then update the oxmysql mysql\_connection\_string to the new user, password and database.

Do I lose txAdmin admins and bans in the migration?

No, as long as you copy the whole txData folder with the server stopped. It holds the admin accounts, the restart schedules and the player database with the punishment history. On the VPS, point txAdmin at that folder and fix the server path in the settings.

Which ports should I open for FiveM on the VPS?

30120 on TCP and UDP, which is where players come in. txAdmin's 40120 should be open only to the staff IP or reached through an SSH tunnel. The database's 3306 stays closed, with MariaDB listening only on localhost.

Can I migrate a FiveM server from Windows to a Linux VPS?

Yes, and it is the most common path. Download the Linux FXServer artifact, replace absolute Windows paths with relative ones and check upper and lower case in file names, because Linux tells them apart. Resources that depend on .dll files need a Linux version.

Next step

See Ryzen VPS

Ryzen 9 9950X VPS in São Paulo with root access, NVMe and gamer Anti-DDoS.

[See Ryzen VPS](https://streethosting.com.br/en/vps/ryzen)

[FiveM server in Brazil Host your GTA RP city with a high-clock CPU, NVMe and Anti-DDoS in São Paulo.](https://streethosting.com.br/en/fivem)

## Related guides

[VPS Advanced How to install a FiveM server with txAdmin on a VPS FiveM is the foundation of GTA RP in Brazil. With txAdmin you install and manage the server from a web panel. Here are the license key, the right ports and the first steps. 3 min Read guide](https://streethosting.com.br/en/guides/vps/install-fivem-server-txadmin-vps) [VPS Intermediate How to install MariaDB or MySQL on an Ubuntu VPS Almost every application needs a database. See how to install MariaDB or MySQL, run the security script, create a database and user, and allow access without exposing the server. 3 min Read guide](https://streethosting.com.br/en/guides/vps/install-mariadb-mysql-ubuntu-vps) [Infrastructure Intermediate Migrate a game server without losing players In a well-run migration the files almost never get lost, but the players do. This guide lays out the timeline, DNS, rehearsal, maintenance window, Discord announcements and rollback plan so the community gets through the move without noticing. 9 min Read guide](https://streethosting.com.br/en/guides/infrastructure/migrate-game-server-without-losing-players)

[← Back to the Guide Center](https://streethosting.com.br/en/guides)
