Skip to content
FIVECRATE

FiveM Database Setup: MariaDB and HeidiSQL Guide

FiveM database setup step by step: install MariaDB instead of XAMPP, create a database and an account, connect HeidiSQL and oxmysql, then import SQL files.

Author: FiveCrate
Published:
Updated:
Read time: 29 min
Applies to
FiveM Legacy and FiveM for GTAV Enhanced; the Qbox, ESX Legacy, StreetKings and WarfareTacticsV txAdmin recipes (November 2026), existing QBCore servers; oxmysql 2.14.4 (November 26, 2026); MariaDB 10.11, 11.4, 11.8 and 12.3 LTS (12.3.4, November 16, 2026); HeidiSQL 12.22 (October 25, 2026); Windows, Debian and Ubuntu
Last verified

Direct Answer

A FiveM database setup has four parts: a MariaDB server, a database with an account for it, the oxmysql resource and a set mysql_connection_string line in server.cfg. Install MariaDB on its own, 10.9.0 or newer for Qbox: the MSI from mariadb.org on Windows, which also installs HeidiSQL for running SQL, importing .sql files and backups, or the mariadb-server package on Linux. Skip XAMPP, which the oxmysql, Qbox and ESX documentation all advise against. A txAdmin recipe for Qbox or ESX Legacy then creates the database, imports its SQL and writes the connection string from the login you enter. On Linux, create a password account for that login first.

What a FiveM database stores and which servers need one

Frameworks and game modes keep their saved data in the database. ESX’s install guide says the framework “stores all player data, inventories, jobs, and vehicles in MariaDB”. The Qbox docs describe the database as the place where your server “stores characters, money, vehicles and so on”.

Not every server needs one. Cfx.re’s txAdmin setup guide tells new owners to pick the CFX Default template for now, because other templates exist, “but some will require a database server”. txAdmin shows database options only when the recipe you pick contains a database task. The ESX Legacy and Qbox recipes do, and so do two game modes, the StreetKings racing recipe and WarfareTacticsV. All four run connect_database; the two framework recipes and StreetKings then import SQL files with query_database, StreetKings its own streetkings.sql.

PartWhat it isWhere it comes from
MariaDB serverThe program that stores the data. It listens on TCP port 3306 by defaultThe installer from mariadb.org, or your Linux distribution’s packages
Database and accountA named database for your server, and the login FXServer usestxAdmin’s deployer creates the database; a dedicated account is yours to create
oxmysqlThe resource that connects FXServer to the databaseDownloaded by the Qbox, ESX Legacy, StreetKings and WarfareTacticsV recipes. qbx_core, es_extended and QBCore’s qb-core all list it as a dependency
mysql_connection_stringThe server.cfg convar that tells oxmysql the host, account, password and databaseWritten by the deployer, or by you on a manual install

The steps are the same on FiveM Legacy and FiveM for GTAV Enhanced. txAdmin’s Legacy recipe index (indexv4.json) and its Enhanced index (indexv5.json) load the same Qbox and ESX Legacy recipe files, and Cfx.re’s page on what changed in Enhanced lists no database changes. Existing QBCore servers use the same oxmysql setup. If you have not chosen a framework yet, the QBCore, Qbox and ESX comparison covers where each one stands in 2026.

MariaDB, MySQL or XAMPP for FiveM

SourceWhat it says
oxmysql documentation“MariaDB is highly recommended for compatibility”. Most FiveM resources were designed for MySQL 5.7 and “may hit compatibility issues when using MySQL 8”
Qbox installation page“We expect you to already have MariaDB installed. MySQL is not supported.” Minimum version: MariaDB 10.9.0
ESX install guide“ESX requires a MySQL-compatible database”, next to the instruction “Use MariaDB only.”
txAdmin recipe documentationThe database task “Connects to a MySQL/MariaDB server”

oxmysql describes itself as having “improved compatibility for MySQL 8”, so the connector works with MySQL. Qbox is the one that rules MySQL out, and the Qbox and ESX documents both point to MariaDB.

Should you use XAMPP for a FiveM server?

No. Three official sources say so plainly:

  • oxmysql: “XAMPP is a webserver stack intended to be used for development”, and “Do not setup XAMPP just to run your database, and install MariaDB directly instead.”
  • Qbox: “XAMPP IS NOT SUPPORTED AND SHOULD NEVER EVEN BE USED.”
  • ESX: “Do not use XAMPP. It is outdated, unstable for production servers, and has been known to cause data loss.”

XAMPP’s own site calls it “an easy to install Apache distribution containing MariaDB, PHP, and Perl”. On November 21, 2026, its Windows downloads bundled MariaDB 10.11.19 together with Apache, PHP, phpMyAdmin, a mail server, an FTP server and Tomcat. The database inside is MariaDB; what XAMPP adds is a web development stack a FiveM server does not use. Old XAMPP installs carry old databases: the Qbox docs list 10.4.x-MariaDB as too old and add “This is common with XAMPP.”

One official message still points the other way. When txAdmin’s Recipe Deployer cannot reach a database on Windows, it adds “If you do not have a database installed, you can download and run XAMPP.” On Linux the same message says “you must download and run MySQL or MariaDB.” The txAdmin hint and the framework and oxmysql documentation disagree here. Follow the documentation and install MariaDB.

Which MariaDB version to install for FiveM

Qbox publishes a version floor: MariaDB 10.9.0. Its installation page gives the reason. The core resource uses JSON_VALUE(), which needs MariaDB 10.6.1, and creates indexes with CREATE INDEX IF NOT EXISTS when it starts, which needs 10.9.0. The ESX install guide and the oxmysql documentation name no minimum version.

For new servers Qbox recommends MariaDB 12.3 LTS and adds that “Older LTS releases such as 10.11 or 11.8 also work”. MariaDB Foundation’s download service listed these long-term support series on December 2, 2026:

SeriesStatusSupport typeEnd of life
10.11StableLong Term SupportFebruary 16, 2028
11.4StableLong Term SupportMay 29, 2029
11.8StableLong Term SupportJune 4, 2028
12.3StableLong Term SupportJune 12, 2029

All four are above Qbox’s floor. The newest 12.3 release that day was 12.3.4, published on November 16, 2026. The same list shows 13.1 as a stable release and 13.2 as a release candidate, both with the support type “Rolling”, so neither is a long-term series.

Step 1: Install MariaDB for FiveM

Windows: the MSI installer

  1. Download the MSI. On mariadb.org/download, choose a series under MariaDB Server Version, Windows under Operating System and the MSI package under Package Type. For 12.3.4 the file is mariadb-12.3.4-winx64.msi.
  2. Run it and accept the license agreement.
  3. Keep the default features in Custom Setup. By default every feature except the debug symbols is installed, and the list includes the database instance and HeidiSQL. Qbox’s instruction is “Leave HeidiSQL ticked, so it gets installed too.”
  4. Set a password for root and write it down. root is the administrator account of the database server. The same dialog asks whether root may access databases from remote machines; leave that off. Create anonymous account is off by default, and MariaDB recommends not changing it. Avoid the characters that oxmysql lists as reserved or unsupported in a connection string: ; , / ? : @ & = + $ #.
  5. Keep Install as service and Enable Networking. The service is named MariaDB by default. Enable Networking turns on TCP/IP and sets the port, 3306 by default. txAdmin and oxmysql connect with a host and a port, so leave it on. If an older database server already uses 3306, the installer suggests 3307: keep it and write it down.
  6. Leave the InnoDB engine settings as they are. MariaDB documents the default buffer pool size as 12.5% of RAM and says the 16k page size “is suitable for most situations”.
  7. Click Install. When the database instance was installed as a service, “the service will be running already” once the installer finishes.

The installer also offers UTF8 as the default server character set, which adds character-set-server=utf8 to my.ini. Afterwards the Start Menu has a MariaDB Client entry for the command-line client, plus Error log and my.ini shortcuts that open those files in Notepad.

Ubuntu and Debian: check the packaged version first

The distribution’s own package is the quickest route, but not every release ships a version Qbox accepts:

ReleaseMariaDB in the releaseMeets Qbox’s 10.9.0 floor
Debian 11 (bullseye)10.5No
Debian 12 (bookworm)10.11Yes
Debian 13 (trixie)11.8Yes
Ubuntu 22.04 LTS (jammy)10.6No
Ubuntu 24.04 LTS (noble)10.11Yes
Ubuntu 26.04 LTS (resolute)11.8Yes

The Debian versions come from Debian’s release notes, the Ubuntu versions from Ubuntu’s package search on November 21, 2026. Qbox’s Linux tutorial asks for “A fresh Ubuntu 20.04+ or Debian 11+ server” and installs the distribution package. On Debian 11 and Ubuntu 22.04 that package is older than the floor on Qbox’s own installation page, so use MariaDB’s repository there instead. The MariaDB Server Repositories tab of mariadb.org/download asks for your distribution, a MariaDB Server version and a mirror. As the page notes, “MariaDB Foundation provides packages for MariaDB versions newer than the version provided by the distribution only.”

On the other releases, install the distribution package. The commands come from MariaDB’s quickstart and Qbox’s tutorial:

sudo apt update
sudo apt install -y mariadb-server mariadb-client
sudo systemctl status mariadb

MariaDB “typically starts automatically after installation”. If the status shows it stopped, sudo systemctl start mariadb starts it. Installing FXServer itself on these systems is covered in the Linux server guide.

On Linux, root logs in through sudo, not a password

MariaDB’s troubleshooting guide puts it in one line: “The default security model for Linux installations uses the unix_socket authentication plugin.” The root@localhost account “accepts the operating system user root through unix_socket, and has no usable password”. Three things follow:

  • Administer the server with sudo mariadb. It asks for no database password. Older tutorials type mysql, which on Unix systems is a symlink to the same mariadb client.
  • Password logins as root fail until a password is set. Run from a normal user, mariadb -u root -p ends in Access denied for user 'root'@'localhost', in MariaDB’s words “with or without a password”.
  • FXServer cannot log in as this root. The deployer and oxmysql log in with a user name and a password. Create a dedicated account in Step 2. MariaDB gives the same advice: use sudo “as a one-off”, then “create a proper user”.

Qbox’s Linux tutorial, like MariaDB’s own quickstart, then runs the secure-installation script and sets a root password. MariaDB’s page for the script, now called mariadb-secure-installation, says the opposite: many reasons for the script “no longer apply” and “there is usually no need to create a root password”. The script still lets you remove anonymous accounts, root accounts that can be reached from outside the local host, and the test database.

Step 2: Create the database and an account for FXServer

Deploying a framework from a txAdmin recipe on Windows? The deployer creates the database itself and can log in as root, so you can go to Step 4 now and add the account afterwards. ESX’s post-installation checklist asks for exactly that: “Create a dedicated MariaDB user for ESX instead of using root (security best practice)”. To add it afterwards, run the statements below without the CREATE DATABASE line and with the name of the database the deployer created, then put the new user and password in mysql_connection_string, the line in server.cfg that holds the login your server uses. On Linux, do this step first, because root has no password the deployer can use.

Open a SQL prompt: sudo mariadb on Linux, or HeidiSQL’s Query tab on Windows (Step 3 shows how to connect). The statements below are the database block of Qbox’s Linux tutorial. Replace fivem_server, fivem_user and your_password with your own values, and keep the characters oxmysql reserves (; , / ? : @ & = + $ #) out of the password:

CREATE DATABASE fivem_server;
CREATE USER 'fivem_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON fivem_server.* TO 'fivem_user'@'localhost';
FLUSH PRIVILEGES;
PartWhat it does
CREATE DATABASECreates the database. Its CHARACTER SET and COLLATE clauses are optional; left out, the server defaults are used
'fivem_user'@'localhost'An account name has a user part and a host part. 'localhost' allows local connections only. With no host part, MariaDB assumes '%', which matches any host
IDENTIFIED BYSets the password. Without this clause the account connects with no password
GRANT ... ON fivem_server.*A new account starts with no privileges. fivem_server.* is the database level: it covers all tables in that database, “including those created later”
ALL PRIVILEGESEvery privilege at that level, but not GRANT OPTION. A framework needs more than reading and writing rows: Qbox adds columns and creates indexes from its core resource
FLUSH PRIVILEGESNot required. MariaDB says it “is only needed if one modifies the mysql tables directly” and is “not needed when using CREATE USER, DROP USER, GRANT etc.”

For Qbox, give the database Qbox’s collation. A collation is the set of rules a table uses to compare and sort text. The core tables in Qbox’s qbx_core.sql declare utf8mb4_unicode_ci, and its docs warn that linked tables “must use the same collation”. At the prompt, write the first statement as CREATE DATABASE fivem_server CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;. In HeidiSQL, right-click your connection (the top line of the list on the left), choose Create new, then Database, type the name, set Collation to utf8mb4_unicode_ci and click OK. When you deploy Qbox from its recipe, the deployer would otherwise create the database with utf8_general_ci. Create it this way first and type its name in the deployer’s Database Name field in Step 4: a name other than the default switches Delete Database off, and CREATE DATABASE IF NOT EXISTS only returns a warning for a database that already exists.

Which collation a new FiveM database gets

How the database is createdDefault character set and collation
txAdmin’s deployerutf8 and utf8_general_ci
CREATE DATABASE without clauses, MariaDB 11.6 or newerThe server default, utf8mb4 and utf8mb4_uca1400_ai_ci
CREATE DATABASE without clauses, before MariaDB 11.6The server default, latin1 and latin1_swedish_ci

MariaDB adds that the server default “may differ in some distros”. It also changes with the character_set_server variable, so on Windows the installer’s UTF8 option, which writes character-set-server=utf8 to my.ini, changes it too. A table takes the database default only when its SQL names neither a character set nor a collation. The tables in Qbox’s qbx_core.sql declare utf8mb4 and utf8mb4_unicode_ci. Most tables in ESX’s legacy.sql declare neither, so they take whatever the database default is. Tables that refer to each other must end up with the same collation; a mix is what produces the foreign key error under Troubleshooting.

Step 3: Connect HeidiSQL to your FiveM database

HeidiSQL comes with the MariaDB installer for Windows. Otherwise it is a separate download from heidisql.com, where version 12.22 was released on October 25, 2026. Its help calls it “a so called client application, only usable when you have some server available”.

  1. Open HeidiSQL. The Session manager opens.
  2. Click New at the bottom left.
  3. Fill in the session with the values from the table below.
  4. Click Open.
FieldValue
Network typeMariaDB or MySQL (TCP/IP)
Hostname / IP127.0.0.1 when the database runs on the same PC
User and Passwordroot and the installer password, or the account from Step 2
Port3306, or the port the installer used instead

HeidiSQL’s help notes that most settings of a new session are already filled in, “except from the password, which is mostly not an empty one on a newly installed MariaDB server”.

Once you are connected, three habits from Qbox’s basics page prevent most mistakes:

  • Select the database first. The list on the left shows every database on the server, and every command runs on the selected one. SELECT DATABASE(); shows which one that is.
  • Run SQL in the Query tab. Paste the statement, then click the blue Execute SQL button or press F9. Results appear in a grid below; an error opens a popup that starts with SQL Error.
  • Press F5 to refresh the list after you add or change tables.

Check the server version with SELECT VERSION()

Run this in the Query tab:

SELECT VERSION();
ResultMeaning
A value such as 11.8.3-MariaDB or 12.0.2-MariaDB, at 10.9 or higherFine for Qbox
10.4.x-MariaDB or another version below 10.9Too old for Qbox; common with XAMPP
A number without MariaDB, such as 8.0.36MySQL, which Qbox does not support

A database on a Linux VPS: HeidiSQL through an SSH tunnel

HeidiSQL can reach a database server “which is only accessible via SSH”, so the database port can stay closed. Pick the SSH tunnel network type (the help lists it as MariaDB/MySQL (SSH tunnel)) and use the help’s example settings:

  • Settings tab: Hostname 127.0.0.1, the database account’s password, and Port 3306 “in most cases”.
  • SSH tunnel tab: your server as SSH host, port 22 “in most cases”, your SSH user and password, and Local port 3307.

The HeidiSQL installer places plink.exe in the right folder, and recent versions can use Microsoft’s ssh.exe instead. Log in with a password account such as the one from Step 2: the Linux root account only accepts the system root user through the local socket file.

Step 4: Connect FXServer to the database

New server: the database options in the txAdmin deployer

When a recipe contains database tasks, the deployer’s Step 2: Input Parameters shows a button named Show/Hide Database options (advanced). The fields behind it start collapsed but already filled in, so the defaults are used unless you open it.

FieldDefaultWhat to enter
Database HostlocalhostKeep it when MariaDB runs on the same machine
Database Port3306The installer’s port if it differs
Database Usernamerootroot on Windows; on Linux the account from Step 2
Database PasswordEmptyThe password you set. The field’s hint reads “(usually blank)”, which does not hold for a MariaDB server installed as described above
Database NameThe deployment ID, such as PlumeESX_BBC957Keep it with root. With a dedicated account, type the database that account has privileges on
Delete DatabaseOnRead the first point below

Before you move on to Step 3: Run Recipe:

  • Know what Delete Database does. Its hint says it “automatically deletes the database with the name provided above” and warns “all data will be lost.” The switch is On for the default name. Typing a different name in Database Name switches it Off; clearing the field or typing the default name switches it back On. Qbox’s migration guide gives the safe rule: “Never delete or empty a database to reuse it. Always make a new one.”
  • txAdmin tests the login first. It connects with the host, port, user and password before any task runs. If that fails, the page shows “Database connection failed:” and the reason; Troubleshooting covers both usual reasons.
  • The database is created when needed. The deployer drops the database if Delete Database is on, runs CREATE DATABASE IF NOT EXISTS with the name, and then runs the recipe’s SQL files in it. A dedicated account can do this for its own database, because MariaDB lets you grant the CREATE privilege “on databases that do not yet exist”.

When the tasks finish, the deployer replaces the variables in server.cfg, which fills in the connection string. Qbox’s migration guide shows the result:

set mysql_connection_string "mysql://root:YourPassword@localhost/qbox_a1b2c3?charset=utf8mb4"

The port appears after the host only when it is not 3306. With an empty password, the string has no :password part. The txAdmin recipe guide walks through the other deployer steps.

Existing server or manual install: oxmysql and mysql_connection_string

oxmysql’s documentation gives the manual installation in three moves: download the latest release of oxmysql, add start oxmysql to the top of your resource list, and set the connection string “before starting any resources”. It accepts two formats:

set mysql_connection_string "mysql://root:12345@localhost:3306/fivem"
set mysql_connection_string "user=root;password=12345;host=localhost;port=3306;database=fivem"

Use one of the two lines, with your own account, password and database name in place of root, 12345 and fivem.

  • Only ever use set. That is the wording of the oxmysql docs. Cfx.re’s convar reference explains the difference: a standard convar “can only be used in server-side scripts”, while a setr convar is made “available on the client side”. The connection string holds your database password.
  • A different port goes after the host, as in Qbox’s example mysql://root:YourPassword@localhost:3307/qbox_migration?charset=utf8mb4.
  • Without the line, oxmysql does not stop. Version 2.14.4 falls back to mysql://root@localhost, which is root with no password and no database. A missing or misspelled line therefore shows up as a login attempt by root without a password.

Restart the server and read the console, the Live Console page in txAdmin. On success, oxmysql prints the database server’s version in square brackets, followed by Database server connection established!. On failure, it prints Unable to establish a connection to the database with the error code in brackets and the error message, then its connection settings with the password shown as ******. It tries again every 30 seconds. The oxmysql connection string guide covers every other option of that line.

How to import an SQL file into a FiveM database

A recipe imports its own SQL, so a freshly deployed framework needs no manual import. You import by hand when a resource you add later asks for it. ESX’s vehicle shop README is a typical example: “Import esx_vehicleshop.sql in your database”.

Before you run any file:

  • Back up first. The next section shows how. MariaDB’s restore guide warns that when a file contains DROP TABLE and CREATE TABLE statements, “existing tables with the same names will be dropped and recreated”.
  • Look inside the file. Open it in a text editor and search for CREATE DATABASE, then for DROP DATABASE. MariaDB notes that dump files often contain CREATE DATABASE IF NOT EXISTS and USE statements. Qbox’s basics page explains the consequence: such a file “would write into your original database instead of the new one”.

HeidiSQL:

  1. Select the database in the list on the left.
  2. Click File, then Run SQL file… and pick the file.
  3. Choose the encoding if you know it. Below the file name there is an Encoding menu. HeidiSQL’s help calls “Auto detect” “a common way to get broken data afterwards” and tells you to select the right one, for example “UTF-8”.
  4. Click OK. HeidiSQL starts executing the commands immediately and shows the progress. Press F5 afterwards and the new tables appear in the list.

Command line (Linux):

mariadb --user your_username --password your_database_name < /path/to/your/backupfile.sql

The client asks for the password, and the < sign feeds the file to it.

phpMyAdmin (hosted databases): open the database first, then go to the Import tab. phpMyAdmin’s documentation adds that you can drag an SQL file from your file manager onto the phpMyAdmin window.

The rest of a resource install, from the folder to the ensure line, is covered in how to install FiveM scripts. For an escrowed resource that will not start, see the entitlement error guide.

Back up the database before you change it

HeidiSQL: right-click the database and choose Export database as SQL, make sure your database is ticked on the left, and use Qbox’s settings:

OptionSettingWhy
Database(s)Untick Drop and CreateThe backup can be loaded into a database with a different name later
Table(s)Tick Create, untick DropA backup loaded into the wrong database by mistake fails instead of overwriting tables
DataInsertThe default; No data would export the structure only
OutputSingle .sql fileUse a file name with the date

HeidiSQL’s help describes its export as “basically what mysqldump also does”.

Command line (Linux): MariaDB’s backup guide gives this form for a database of InnoDB tables:

mariadb-dump --user=admin_backup --password --single-transaction --extended-insert --databases your_innodb_database > /data/backup/your_innodb_database.sql
  • mariadb-dump “was previously known as mysqldump”, and it can run while the database server is running.
  • --single-transaction reads “from a consistent snapshot without locking the tables for extended periods”.
  • --databases puts CREATE DATABASE and USE statements into the file, so it restores into a database of the same name.

Replace admin_backup with an account that can read the database and your_innodb_database with your database. MariaDB’s guide adds that --single-transaction may also need the PROCESS and RELOAD privileges, which a database-level grant such as the one in Step 2 does not include. Test a backup by restoring it somewhere that is not your live server, and store backups outside the server folder. If a live database is ever damaged, Qbox’s advice is “don’t load the backup over it”: load it into a new database and change the database name in mysql_connection_string.

Keep the database private: bind-address and port 3306

When FXServer, MariaDB and HeidiSQL run on the same machine, nothing outside it needs port 3306. The official sources do not describe MariaDB’s default listening address the same way:

  • MariaDB’s system variable reference: “By default, the MariaDB server listens for TCP/IP connections on all addresses”, and “In some systems, such as Debian and Ubuntu, the bind_address is set to 127.0.0.1”.
  • Qbox’s remote access article: “By default, MariaDB only listens on localhost (127.0.0.1).”
  • MariaDB’s page for the Windows installer: “If security is a concern, you can change the bind-address parameter post-installation to bind to only local addresses.”

Debian and Ubuntu packages start local-only. On Windows, do not assume it. To bind the server to the local machine, add bind-address = 127.0.0.1 under the [mysqld] section of the configuration file and restart MariaDB:

WindowsDebian and Ubuntu
Configuration filemy.ini in the data directory, for example C:\Program Files\MariaDB X.X\data\my.ini/etc/mysql/my.cnf
Restartnet stop MariaDB, then net start MariaDB, in a Command Prompt opened as administratorsudo systemctl restart mariadb

When another machine really does need the database, Qbox’s remote access article first sets bind-address = 0.0.0.0 under [mysqld], so that MariaDB listens on all network interfaces. Its firewall rule is “Never open port 3306 (default MariaDB port) to the entire internet.” Allow only that machine’s fixed IP address: Qbox’s Linux example is sudo ufw allow from 203.0.113.7 to any port 3306 proto tcp, and on Windows it creates an inbound New-NetFirewallRule for TCP port 3306 with -RemoteAddress set to that address, in PowerShell opened as administrator. MariaDB checks a login against the account’s user and host, so that machine also needs an account created for its address; MariaDB calls allowing 'root'@'%' from the internet “highly discouraged”. For HeidiSQL alone, the SSH tunnel in Step 3 gives the same access while the port stays closed.

Move a server from XAMPP or MySQL to MariaDB

Qbox’s migration basics describe this route for owners whose SELECT VERSION(); shows an old XAMPP database or MySQL:

  1. Back up the database as an .sql file, as in the backup section. With the Database(s) boxes unticked, the file loads under any name.
  2. Install MariaDB next to the old server. The old server keeps running. Because it already uses 3306, the installer suggests 3307 for the new one.
  3. Create a database on the new server and load the file. Connect HeidiSQL with Port 3307, create the database, select it, then click File and Run SQL file….
  4. Point FXServer at the new server. Add the port after the host in mysql_connection_string, with the new server’s password and the new database name.
  5. Keep the old database. Qbox’s rule: “Keep your backups until well after you go live. Don’t delete the old database or server folder.”

Moving from QBCore to Qbox at the same time is a larger job, covered step by step in the QBCore to Qbox migration guide.

A FiveM database at a game server host

  • The host runs the database server. According to the Qbox docs, a game server provider’s control panel “usually has phpMyAdmin”.
  • The deployer fields may be filled in already. A host can preset them, and txAdmin then shows a note that the values “were auto-filled” and that editing them is “strongly disencouraged”, in its own spelling. A preset database name becomes the default name, so Delete Database starts On for it.
  • Check the version on phpMyAdmin’s start page, which shows the Server version. If it is MySQL or a MariaDB older than 10.9 and you want Qbox, the Qbox docs say to ask your host to move you to a current MariaDB.
  • Use the Export tab for backups and the Import tab for .sql files.

Troubleshooting

txAdmin shows “Database connection failed” in the Recipe Deployer

The deployer logs in with the host, port, user and password from the database options before it runs any task.

  • The reason contains ECONNREFUSED. Node.js defines this code as a connection the target machine “actively refused”, usually because the service “is inactive” on that host. MariaDB is not running, or not on that port. On Windows, check the MariaDB service; ESX’s guide says to “Check Windows Services and verify your password”. On Linux, run sudo systemctl status mariadb. With a port other than 3306, txAdmin adds “You are not using the default DB port 3306, make sure it is correct!”. Ignore the XAMPP suggestion in the Windows message.
  • The reason is an access error. Open Show/Hide Database options (advanced) and type the account and password. The default password is an empty one, and the default user on Linux is the socket-only root.

“Access denied for user ‘root’@‘localhost’” on Linux

When the message has no using password part, it is MariaDB error 1698. The root account authenticates through unix_socket, and MariaDB’s reference says “A password on the command line makes no difference”. Use sudo mariadb for administration and a dedicated account for FXServer, as in Step 2.

“Access denied for user … (using password: YES)” in the server console

This is error 1045, ER_ACCESS_DENIED_ERROR. MariaDB’s reference says a wrong password, a missing password and a user name that has no account “all give the same error”. using password: YES only means that a password was sent; using password: NO means none was, which points to a connection string without a password.

  • Check the account and its host. MariaDB’s advice is to check that an account exists “for the user and the host that the error message names”. Its own pages differ on one detail: the error reference says that while skip_name_resolve is off, its default, a TCP connection to 127.0.0.1 is reported as localhost, but the CREATE USER page says that on Linux 127.0.0.1 “will not match ‘localhost’”. Go by the host printed in the error and create the account for exactly that host.
  • Check for an anonymous account. An account such as ''@'localhost' can match a local connection before yours does, and then the login fails even with the right password. MariaDB’s fix is DROP USER ''@'localhost'; or mariadb-secure-installation.

“Access denied for user … to database” or “Unknown database”

Error 1049, ER_BAD_DB_ERROR, reads Unknown database: the database name in the connection string does not exist on the server. Error 1044, ER_DBACCESS_DENIED_ERROR, means the account “has no privileges on the database it tries to use”, and MariaDB returns “the same error for a database that doesn’t exist”. With a dedicated account, a typing mistake in the database name therefore looks like a missing privilege, and so does a deployer run that kept the default deployment ID as the name. Compare the name in mysql_connection_string with the list in HeidiSQL, then check the GRANT line from Step 2.

“Foreign key constraint is incorrectly formed” when you run an SQL file

Qbox’s FAQ attributes this error to “a mismatch of collation types between the table being created and existing tables”. Its fix is to add DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; to the end of the CREATE TABLE parts of the file, and to drop and re-add the table if it already exists. The collation table in Step 2 shows where a different default comes from.

“You have an error in your SQL syntax” when you run Qbox’s SQL

Qbox relies on statements that older servers reject. Its installation page lists ADD COLUMN IF NOT EXISTS in qbx_core.sql (MariaDB 10.0.2) and CREATE INDEX IF NOT EXISTS on resource start (MariaDB 10.9.0). Qbox’s migration guide lists this error for its collation statements: check that you copied the whole block, and if you did, “your MariaDB is too old”. Check the version with SELECT VERSION();.

HeidiSQL: “Lost connection to MySQL server at ‘reading initial communication packet’”

HeidiSQL’s help says this error is mostly caused by an SSH tunnel onto the public address of the server. Use 127.0.0.1 in Settings > Hostname/IP, and the server’s remote IP in SSH tunnel > Host.

oxmysql prints “Unable to establish a connection to the database”

The code in brackets says why, for example ECONNREFUSED when nothing accepted the connection on the host and port in mysql_connection_string. oxmysql’s common issues list, which the error message links to, calls this “an incredibly generic error” and starts with three checks: the connection string is configured correctly, the database “exists and is running”, and the string has no reserved characters. The ECONNREFUSED guide goes through each cause.

Next Steps

Official documentation and repository references