Skip to main content

Launch your FiveM server in just a few clicks! Optimized hosting, DDoS protection included, and 24/7 support.

Discover our FiveM plans

Link MySQL database to FiveM

This tutorial explains how to link your MySQL database to your FiveM server.

Prerequisites​

Make sure you have installed one of the following MySQL connection scripts:

Installation​

  1. Download the script of your choice
  2. Place it in your resources folder
  3. Add ensure oxmysql or ensure mysql-async to your server.cfg

Connection configuration​

Open your server.cfg file and add the following connection string:

set mysql_connection_string "mysql://USERNAME:PASSWORD_DATABASE@mysql.yorkhost.fr/NAME_DATABASE?charset=utf8mb4"
Automatic generator

Use our online generator to automatically create your SQL connection string.

Parameters to replace​

ParameterDescriptionWhere to find it
USERNAMEUsernameDatabase tab on the panel
NAME_DATABASEDatabase nameDatabase tab on the panel
PASSWORD_DATABASEDatabase passwordDatabase tab on the panel

MySQL server address​

Warning

The MySQL server address (the part after the @) depends on your hosting plan. Check the address or IP provided in the Database tab on the WISP / Pterodactyl panel.

For a FiveM Intel plan, the address is usually: mysql.yorkhost.fr

Common issues​

Password containing special characters​

Passwords containing the = character may cause connection problems.

Solution:

  1. Go to the Database tab on your panel
  2. Click Reset password
  3. Repeat until you get a password without the = character

Connection error​

If you get a connection error:

  • Check that all parameters are correct
  • Make sure the MySQL script is running (ensure oxmysql)
  • Verify that your database exists on the panel

Complete example​

# Database connection
set mysql_connection_string "mysql://s1_myserver:MyPassword123@mysql.yorkhost.fr/s1_myserver?charset=utf8mb4"

# Start MySQL script
ensure oxmysql

Best regards, the YorkHost team