Skip to content
Black Friday · −50 % off your first invoice on Xeon VPS with code BF50XEON, −30 % off our other services with BF30 · domain names and dedicated servers excluded See our plans
CloudFive
Log in

01

What oxmysql is for

FiveM can't talk to a database on its own. oxmysql is the resource that does it: frameworks (ESX, QBCore, Qbox) and most roleplay scripts go through it to read and write their data.

It replaced the older mysql-async and ghmattimysql resources, and provides their functions so old scripts keep working. On a recent server, it is the one to use, and only one at a time: don't keep the old ones running in parallel.

02

The database: MariaDB or MySQL

oxmysql works with MariaDB or MySQL. MariaDB is the most common choice for FiveM. You need:

  • an empty database, created for the server;
  • a user with a password, with rights on that database;
  • the address of the database server (often localhost when it runs on the same machine).

txAdmin recipes for ESX or QBCore create the database and import the tables for you. If you install a framework by hand, import the .sql file that comes with it, then those of every script that has one.

03

The connection string in server.cfg

oxmysql reads its credentials from the mysql_connection_string variable, to be placed in server.cfg:

set mysql_connection_string "mysql://utilisateur:motdepasse@localhost/mabase?charset=utf8mb4"
  • replace the user, password, address and database name with your own;
  • if the password contains special characters (@, :, /…), encode them or use a password without them;
  • charset=utf8mb4 avoids problems with accents and emojis in character names.

This file contains a password: never share it as is, not even in a screenshot when asking for help.

04

The start order

oxmysql must start before everything that uses the database: in server.cfg, the ensure oxmysql line comes before the framework and the scripts.

ensure oxmysql
ensure ox_lib
ensure es_extended

If a script starts before oxmysql, it crashes at startup or doesn't load its data, even if the connection works.

05

Common errors

  • ECONNREFUSED: oxmysql can't reach the database. The MariaDB server is stopped, the address or port is wrong, or a firewall blocks it.
  • ER_ACCESS_DENIED_ERROR: the user or password is wrong, or the user isn't allowed to connect from that address.
  • ER_BAD_DB_ERROR: the database given doesn't exist. Check its name in the connection string.
  • ER_NO_SUCH_TABLE: a table is missing. The .sql file of the framework or script wasn't imported.
  • Slow query warnings: a script queries the database too often or without indexes. The optimising a FiveM server guide helps find the culprit.
06

Backing up the database

The database is the progress of all your players. Back it up regularly, and always before a framework update or adding a script that changes the tables. An SQL export (with mysqldump or a tool such as HeidiSQL) can be restored in minutes. Keep several backups: a mistake can go unnoticed for days.

07

The database at CloudFive

Our FiveM plans include MariaDB databases, created and managed from the customer area. When you install ESX, QBCore or Qbox in one click, the database is created and server.cfg filled in for you; automatic backups also cover the database. The ESX, QBCore or Qbox guide helps you choose the framework.

08

Frequently asked questions

What is oxmysql on FiveM?

It is the resource that links the FiveM server to its MariaDB or MySQL database. The ESX, QBCore and Qbox frameworks and most roleplay scripts go through it.

Where do I put the database connection on FiveM?

In server.cfg, with the line set mysql_connection_string followed by the connection address: user, password, server address and database name.

Why can't oxmysql connect?

Most often, the database server is stopped or unreachable (ECONNREFUSED), or the user and password are wrong (ER_ACCESS_DENIED_ERROR). The console shows the exact error.

Does oxmysql replace mysql-async?

Yes. oxmysql provides the functions of mysql-async and ghmattimysql, so old scripts keep working. Use only one of these resources at a time.

Our plans

Going further.

The plans covered in this guide, hosted in France and protected by our anti-DDoS, with no commitment.

Support CloudFive AI

An answer right away, a real team behind it.

CloudFive AI answers you at any hour, in seconds. When it doesn’t know, or as soon as you ask, the team that runs the machines takes over. No offshore call centre.

  • TicketThe team replies in under 2 hours, 7 days a week.
  • CloudFive AIAt any hour, on ia.cloudfive.fr, Discord and in your customer area.
  • DiscordThe team, the AI and other customers, in the help channel.
  • Your data stays with usAI runs on our servers in France; e-mails, IPs and passwords are masked.
A ticket in the customer area: a customer’s question about a Minecraft plugin, and the CloudFive team’s reply
A real ticket in the customer area, answered by the team (demo account; shown in French).
CUSTOMER AREA · APP

Your servers.
At your fingertips.

Restart a server, watch its resources live, pay an invoice or open a ticket — and get an alert when something goes wrong.

  • The status of all your services at a glance
  • Blocked attacks, filtered traffic, monthly peak
  • A notification when a server goes down or an invoice is due

App coming soon · in the meantime, everything works in your browser at manager.cloudfive.fr

The CloudFive app: the list of your services, with their status
The CloudFive app: the home screen, your services’ status, blocked attacks and an invoice to pay