☀️ 50% off your first month:SUMMER26
FiveMFivem·Configuration

How to Connect a Database to Your FiveM Server

Create a MySQL database in the DoomHosting panel, point oxmysql at it from server.cfg, and import your ESX or QBCore schema on your FiveM server.

Magnus·
7 min read
·
Jul 25, 2026
Table of Contents

How to connect a database to your FiveM server

Every roleplay framework worth running on FiveM stores its data in MySQL: characters, jobs, vehicles, inventories, bank balances. Your DoomHosting FiveM server includes a MySQL database slot you create yourself in the panel's Databases tab, and connecting it takes one line in server.cfg. This guide covers creating the database, building the connection string oxmysql expects, adding it to the config, and importing an ESX or QBCore schema.

What you need

  • A FiveM server on DoomHosting that already boots. If it does not start yet, set the license key first: how to get a FiveM license key.
  • oxmysql, the resource every modern framework uses to talk to MySQL. ESX and QBCore both ship with it.
  • A MySQL client on your PC if you plan to import a framework schema. HeidiSQL (Windows) and DBeaver (all platforms) are both free.

Create the database in the panel

  1. Open your game servers and click your FiveM server.
  2. In the section nav, under Advanced, open Databases.
  3. Click New database, type a short name (letters, numbers and underscores only), and confirm.

We create the database and a matching user with a generated password. The name gets a prefix automatically, so a database you call esx ends up as something like s1708_esx, and the user looks like u1708_esxdemo.

The Databases tab in the DoomHosting panel showing a FiveM database with its host, username and password

The row shows three credential chips. Host is the database address including its port, Username is the generated user, and Password is hidden until you click the eye icon. Click a chip to copy its value. Two buttons sit on the right: New password rotates the password (anything still using the old one stops working immediately), and the trash icon deletes the database and all of its data permanently.

The New database dialog in the DoomHosting panel with a name typed in

The card header counts your slots, for example 1 of 1 databases used. One slot covers a normal ESX or QBCore setup, since a framework and all of its resources share a single database. Contact support if your build genuinely needs a second one.

Get your connection string

oxmysql reads one convar, mysql_connection_string, and accepts two formats:

set mysql_connection_string "mysql://u1708_esxdemo:[email protected]:3306/s1708_esx"
set mysql_connection_string "user=u1708_esxdemo;password=YourPassword;host=203.0.113.10;port=3306;database=s1708_esx"

Fill the four values straight from the Databases tab: the user from Username, the password from Password, the database name from the row title, and the host from Host. The Host chip already contains the port in address:port form. In the URI format you paste it as-is after the @. In the key and value format you split it at the colon, address into host= and port into port=.

Use the second format. Passwords we generate mix letters and digits with symbols from the set ! @ = . + ^, and oxmysql documents ; , / ? : @ & = + $ # as reserved inside a connection string. A password containing @, = or + breaks the mysql:// URI silently: the parser reads part of your password as the hostname and the connection fails with credentials that are perfectly valid. The user=...;password=... form has no such parsing trap.

Add it to server.cfg

  1. Open the Files tab and click server.cfg to edit it in the browser.
  2. Put the connection string above every resource line, then start oxmysql before your framework:
set mysql_connection_string "user=u1708_esxdemo;password=YourPassword;host=203.0.113.10;port=3306;database=s1708_esx"

ensure oxmysql
ensure es_extended
  1. Save the file, then restart the server from the top of the panel. Convars are read once at boot, so an edit does nothing until the server restarts.

Editing server.cfg in the panel Files tab with the mysql_connection_string line at the top

Two things to leave alone. Our startup rewrites the endpoint_add_tcp and endpoint_add_udp lines to your allocated port on every boot, so there is no point editing them. And treat server.cfg as a secret file: it now holds your database password next to your license key, so never paste it into a Discord support channel without blanking both.

If you turned on txAdmin from the Enable txAdmin chip on Overview, FXServer no longer runs /home/container/server.cfg directly. txAdmin owns the boot and runs the server from its own data folder, /home/container/txData, so edit the server.cfg inside the deployment folder there, or use the CFG editor built into txAdmin itself. You reach the web panel with Open txAdmin on Overview.

Install oxmysql

Check resources first. ESX and QBCore recipes almost always include oxmysql already, and a second copy causes a resource name conflict rather than a faster server.

If it is missing, download the latest release from the oxmysql repository, unzip it, and upload the oxmysql folder into your resources directory from the Files tab. Then add ensure oxmysql above your framework resources as shown above. If your build still carries mysql-async or ghmattimysql, delete them: oxmysql provides their exports, and running both at once produces duplicate query handlers.

The oxmysql documentation covers the extras, including set mysql_debug true to print every query to the console and set mysql_slow_query_warning 150 to flag slow ones.

ESX and QBCore notes

Both frameworks query through oxmysql, so a single connection string serves the framework and every resource on top of it. What neither does for you is create its tables. You import those yourself:

  1. Install HeidiSQL or DBeaver on your PC.
  2. Create a new MySQL or MariaDB connection with the Host address and its port, plus the Username and Password from the Databases tab. The user we create is allowed to connect from any address, so a client on your home connection works without extra setup.
  3. Select your database, open the framework's .sql file, and run it.

For ESX, that is the es_extended SQL file plus whatever each addon ships. See the ESX documentation. For QBCore, import the qb-core dump first, then the per resource files, as described in the QBCore documentation. Import the schema before the first boot with the framework enabled, otherwise the console fills with missing table errors on startup.

One thing worth knowing about backups: panel backups archive your server files, not the MySQL database. Export a .sql dump from your client before a big framework update or a wipe.

Common issues

Failed to connect or access denied on boot. Nine times out of ten the string still says localhost. There is no MySQL server inside your game container, so the host has to be the address from the Databases tab.

Credentials are correct but authentication keeps failing. The password contains @, = or + and you are using the mysql:// format. Switch to the user=...;password=...;host=... form. Clicking New password may also hand you a cleaner password, but the second format is the reliable fix.

Resources start before the convar is set. oxmysql connects when it starts, so the set mysql_connection_string line has to sit above ensure oxmysql. Use set, not sets or setr: those publish the value to every connecting player.

Nothing changed after editing the config. Restart the server. A live server never rereads server.cfg.

Unknown table or column errors. The connection works and the schema was never imported, or it was imported into the wrong database. Confirm in HeidiSQL that the tables exist inside your prefixed database, not in a second one you created by hand.

You edited server.cfg but txAdmin is enabled. txAdmin runs its own copy under /home/container/txData. Edit that one, or the file you changed is simply never read.

The Databases tab says databases are not available. Your server has no database slot. Contact support and we will look at the service.

Next steps

Your framework now has a home for its data. If you are still setting the server up, the license key guide is here: how to get a FiveM license key. Full plan details, hardware and pricing live on the FiveM server hosting page.

Fivem

Start your Fivem Server

High performance hosting with 24/7 support