01
What HeidiSQL is for on FiveM
The ESX, QBCore and Qbox frameworks store everything in a MariaDB or MySQL database: characters, money, inventories, vehicles, jobs. The FiveM server reaches it through the oxmysql resource. HeidiSQL gives you a window onto that database: the list of tables, their contents and an SQL query editor.
- Free and open source: it is released under the GPL licence and downloaded from the official site, heidisql.com.
- Windows first: the official help says it runs fine on Windows 11. It also mentions a Linux version and a macOS version for Apple silicon Macs only.
- Several databases: MariaDB and MySQL, the ones FiveM uses, but also PostgreSQL, Microsoft SQL Server and SQLite.
HeidiSQL is only a client: it contains no database. You need a MariaDB server already running, the one your FiveM server uses. To choose and install a framework, see ESX, QBCore or Qbox.
02
Connecting to the database
First gather the connection details. They are in the mysql_connection_string line of server.cfg, in this form:
set mysql_connection_string "mysql://utilisateur:motdepasse@adresse/nom_de_la_base?charset=utf8mb4"
Then open HeidiSQL. The session manager appears: click New to create a session, then fill in the fields. The labels are given here in English; they are translated if your HeidiSQL is set to another language.
- Network type: MariaDB or MySQL, over TCP/IP;
- Hostname / IP: the database server's address;
- User and Password: the user and its password;
- Port: 3306 in most cases;
- Databases: leave empty to see every database the user can access, or type the name of yours to show only that one.
Click Open. The database appears on the left; clicking it expands its tables.
If the connection fails, the database server may not accept connections from outside: it is a common security choice. HeidiSQL can go through an SSH tunnel when you have SSH access to the machine: you enter the SSH host, its port (usually 22) and your account, and the database address becomes 127.0.0.1.
03
Importing a .sql file (ESX, QBCore, scripts)
Many resources ship a .sql file that creates their tables. It must be imported before the resource starts for the first time, otherwise it stops with an error such as "table doesn't exist".
- Take a backup of the database (see below).
- On the left, click your database to activate it: the file will run inside it.
- Menu File > Run SQL file, then choose the file.
- In the encoding list, below the file name, choose UTF-8. The official help warns that automatic detection often damages data (accented letters, for example).
- Confirm: execution starts immediately, and a window shows the progress.
Read the file before importing it: some start by dropping an existing table (DROP TABLE) to recreate it, which erases its data. A framework's files come before those of the scripts that depend on it. The full method for adding a resource is in the guide installing a FiveM script.
04
Viewing and editing data
Select a table on the left, then open the Data tab: its rows are shown like a spreadsheet. To change a value, click the cell or press F2. On ESX, players are in the users table; on QBCore and Qbox, in the players table.
For a precise change, a query is safer than clicking in the grid. Open a Query tab, write it, then press F9 or the blue play button. For example, on ESX, to move a player into the admin group:
SELECT identifier, `group` FROM users WHERE identifier = 'identifiant-du-joueur';
UPDATE users SET `group` = 'admin' WHERE identifier = 'identifiant-du-joueur';
- Run the
SELECT first with the same WHERE: you see exactly which rows the UPDATE will touch.
- Never an
UPDATE or DELETE without WHERE: the command would apply to the whole table.
- Player offline: frameworks keep connected players' data in memory and write it back on the next save. Edit a player when they are not in game, or with the server stopped.
Not all admin ranks live in the database: QBCore and Qbox handle them through the ACE permissions in server.cfg.
05
Backing up, restoring, staying careful
Exporting the database. Select the database, then menu Tools > Export database as SQL. In the window:
- tick all the tables;
- Database(s) and Table(s): tick creation (create), so the file rebuilds the structure on restore;
- Data: keep INSERT, the default. No data exports only the structure;
- Output: a single
.sql file, optionally ZIP-compressed.
To restore, use File > Run SQL file as for an import. If the server drops the connection during a large restore, lower the maximum INSERT size when exporting: the official help explains that it must stay below the MariaDB server's max_allowed_packet limit.
The safety rules:
- a backup before every import, framework update or manual change, and several backups kept over time;
- never a database open to the Internet without a password, or with a short one. If you open port 3306 yourself, restrict it to your IP address, or use an SSH tunnel;
- never share the
mysql_connection_string line: it contains the password.
The alternative: phpMyAdmin. It is a web interface that does the same job (import, export, table editing) from a browser, with nothing to install on your computer, when it is installed next to the database. The most common server-side database errors are covered in the guide FiveM server errors.
06
On CloudFive
Our FiveM hosting plans, from €2.50 per month, include MariaDB databases. ESX, QBCore or Qbox install in one click with their database, and txAdmin is included. The database connection details (address, port, user, password, name) are in the customer area manager.cloudfive.fr.
If HeidiSQL cannot connect from your computer, remote access to the database may not be possible for your server: ask support, who answer in French 7 days a week, by ticket, on Discord or by phone. Before any change, export the database to SQL: that is your way back.
07
Frequently asked questions
How do I connect HeidiSQL to my FiveM server's database?
In the session manager, create a MariaDB or MySQL session over TCP/IP, then enter the database server's address, the user, the password, the port (usually 3306) and the database name. These details are in the mysql_connection_string line of server.cfg.
How do I import a .sql file with HeidiSQL?
Click your database to activate it, then use the File menu, Run SQL file. Choose UTF-8 encoding rather than automatic detection, and take a backup first: some files drop an existing table to recreate it.
How do I back up a FiveM server's database with HeidiSQL?
Select the database, then open the Tools menu and choose Export database as SQL. Tick all the tables, table creation and data as INSERT, and save everything to a .sql file.
Does HeidiSQL work on Mac or Linux?
HeidiSQL is first and foremost a Windows program. Its official help mentions a Linux version and a macOS version for Apple silicon Macs only; otherwise, phpMyAdmin does the same job from a browser.
Why can HeidiSQL not connect to my database?
The database server may refuse connections from outside, which is a common security choice. Check the address, port and password, try an SSH tunnel if you have SSH access, or ask your host how to reach the database.