Skip to content

How to connect a MySQL database to a FiveM server

Managed from: GamePanel. Updated 7 November 2026.

Create the database in GamePanel (Databases), then paste its credentials into server.cfg on a set mysql_connection_string line.

In the GamePanel

your serverManagementDatabasesOpen

Before you start

The oxmysql resource (or mysql-async for older scripts) in resources. The ESX and QBCore frameworks include it.

  1. GamePanelManagementDatabasesCreate: choose a host, give it a name (e.g. fivem), leave % in "Connections From", then "Submit".

    Creating the database in GamePanel
    Creating the database in GamePanel
  2. In the list, note the database name, the username, the password (click it to reveal it) and the "Connection" column: the address before : is the host, the number after is the port.

    The created database, with its credentials
    The created database, with its credentials
  3. File Manager, server.cfg: add the following line with your values, placing ensure oxmysql before the resources that use the database: set mysql_connection_string "host=HOST;port=PORT;user=USER;password=PASSWORD;database=DATABASE_NAME". If the connection fails even though the credentials are correct (an old password set by hand, containing a = or a ;), use the same line in mysql:// format instead: set mysql_connection_string "mysql://USER:PASSWORD@HOST:PORT/DATABASE_NAME"

    The connection line in server.cfg
    The connection line in server.cfg
  4. With mysql-async, the line reads server=HOST;port=PORT;userid=USER;password=PASSWORD;database=DATABASE_NAME.

  5. Restart and check the console: oxmysql reports the connection is established, otherwise it shows the error (see the common errors below).

    The console: oxmysql connected to the database
    The console: oxmysql connected to the database
  6. To import the .sql file that came with a script or framework: the database's "PHPMyAdmin" button, Import tab.

Common errors

  • Access denied: username or password mistyped, or a = or ; in an old password (use the mysql:// format from step 3). If in doubt, "Reset Password" and paste it again.
  • localhost or 127.0.0.1 as the host: doesn't work, the database is on a different machine. Use the host from the Connection column.
  • Game server port instead of the database port: use the one from the Connection column.
  • mysql://… format: an @, :, /, ? or # in the password breaks the line: reset the password and go back to the first format.
  • oxmysql not found or MySQL not ready errors: ensure oxmysql is missing or placed after your scripts.
  • Can't create another one: the number of databases depends on your plan, the Usage counter on the tab shows it.

Can't find it? Open a ticket from your client area. Terms and conditions: helloserv.fr/en/legal