Skip to main content
TRACK A·INSTALL YOUR SERVER·Verified June 2026 · Lua 5.4 · ox_lib 3.x
Learning with an AI assistant?
Copies this lesson plus 2026 ground rules (no lua54 'yes', Cfx.re Portal, correct callback signatures) as a ready-to-paste mentor prompt.
Step 02

Install tools, account, and database

This step installs the tools FiveM owners use every day. You also create your free Cfx.re license key and set up the MariaDB database before txAdmin asks for it. A license key is the free code that lets your server run. MariaDB is the database engine that stores your players, money, and inventory. Keep one picture in your head: MariaDB is the engine, HeidiSQL is the window you look through it with, and oxmysql is the community add-on (built by Overextended) that lets your scripts talk to the engine later.

You'll do
Install VS Code, an archive tool, WinSCP, MariaDB, and HeidiSQL. Turn on file extensions. Create a Cfx.re account and a free license key.
Time
~30 minutes. Most of it is installers and the account email.
You need
Step 01 done, admin rights on Windows, and an email you can check now.
Result
You are ready to install the latest FiveM artifacts and pick a txAdmin recipe in Step 03.
BEFORE YOU START

The tools you'll install

Use the official downloads only. Do not use random mirrors. The editor edits your files. MariaDB stores your data. HeidiSQL is the window into that data. oxmysql is the add-on your scripts use to reach the data later.

Build it

Install VS Code and turn on file extensions

Right-clicking a folder shows Open with Code, and File Explorer shows full file names.

Download VS Code from code.visualstudio.com/download. Run the Windows User Installer and accept the defaults. On the Additional Tasks screen, tick both Open with Code context-menu options.

Then open File Explorer and turn on File name extensions and Hidden items. On Windows 11: View > Show > File name extensions (and Hidden items). On older Windows: use the checkboxes under the View menu.

Turn on extensions or a broken file will hide from you. A bad config file often looks like server.cfg.txt. FiveM needs server.cfg. With extensions hidden, you cannot see the extra .txt.

To prove it, create a file on your Desktop: right-click the Desktop > New > Text Document, then rename it to proof.cfg and confirm when Windows asks about changing the extension.

text
Desktop\proof.cfg

Install an archive tool

You can extract the .7z and .zip files FiveM ships artifacts in.

FiveM artifacts come as compressed archives. An artifact is the FiveM server program you download in Step 03. Install 7-Zip from 7-zip.org (free) or WinRAR from win-rar.com. Use the 64-bit Windows version and accept the defaults.

To prove it, right-click any .7z or .zip file. The menu now shows an Extract option from your archive tool.

Install WinSCP for later

WinSCP is installed and ready for VPS file transfers in a future lesson.

You do not need this for a local server. Install it now to save time later. WinSCP moves files to a VPS (a rented Windows or Linux machine you run your server on). Download WinSCP from winscp.net/eng/download.php, run the installer with default settings, and do not connect to anything yet.

Create your Cfx.re account and free license key

The key is stored in a password manager and ready for txAdmin.

Every FiveM server needs a license key, even a local test server. The key lets your server connect to the Cfx.re platform and run. It also ties your server to your Cfx.re account. The key is free. You get it from the Cfx.re Portal at portal.cfx.re.

Older guides mention keymaster.fivem.net; the Portal at portal.cfx.re is the current home, and the old link redirects there. Either way you land in the right place.

  1. Create or verify your account at forum.cfx.re and confirm the email.
  2. Go to the portal at portal.cfx.re.
  3. Open Servers, go to the registration keys page, and click Generate Key +. Enter a display name for the server, then click Generate.
  4. Copy the key (a single string starting with cfxk_) into a password manager (Bitwarden is a free option) or a private note you will not lose. If you must use a temporary text file during setup, keep it outside the repository, restrict it to your Windows account, and delete it after txAdmin is configured.

Treat the key like a password. Never paste it in Discord, GitHub, screenshots, or videos. If it leaks, revoke it on the portal and generate a new one.

Install MariaDB

MariaDB runs as a Windows service on 127.0.0.1:3306.

Download the latest Windows x86_64 MSI from mariadb.org/download and run the installer.

  1. Set a strong root password. Store it in a password manager, not a Desktop text file.
  2. The installer checkbox labeled "Use UTF8 as default server's character set" only sets the legacy 3-byte utf8 (utf8mb3), not the full 4-byte utf8mb4 you actually want. You can leave that box unchecked. What matters is creating your database as utf8mb4 later, which you do in HeidiSQL in Step 6. ESX's schema declares utf8mb4 itself; QBCore and Qbox do not declare a charset, so creating the database as utf8mb4 is the safe default.
  3. Keep port 3306 and install it as a Windows service. A Windows service is a program that runs in the background with no window.

Confirm the service is running. Open PowerShell and run:

powershell
Get-Service MariaDB*

If the service has a slightly different name, open Windows Services (run services.msc) and look for MariaDB. The proof you want is the status Running.

Install HeidiSQL and create the database

HeidiSQL connects to MariaDB and shows a database named fivem.

Download HeidiSQL from heidisql.com/download.php and install it. Then create a new session:

  1. Name the session local FiveM.
  2. Host 127.0.0.1, user root, password from your password manager, port 3306.
  3. Open the session, then create the database: right-click the session (top of the left tree) > Create new > Database, name it fivem.
  4. In that same dialog, create it with character set utf8mb4 and collation utf8mb4_unicode_ci, then click OK. Picking the utf8mb4_unicode_ci collation from the dropdown sets the utf8mb4 character set for you. This is the charset the MariaDB installer's "UTF8" checkbox did not give you: that checkbox sets the legacy 3-byte utf8mb3, not the full 4-byte utf8mb4. With utf8mb4, accented player names and emoji store and sort correctly instead of corrupting or breaking on insert.

To prove the connection, do this inside HeidiSQL (the database app you installed, not PowerShell and not the FiveM console). Click the fivem database, open a query tab with the Query button or Ctrl+T, and run:

text
SELECT DATABASE();

Here is what your screen looks like once it works. The session is open on the left, the fivem database sits in the tree, and the query you ran returns its result in the grid below.

HeidiSQL · local FiveM
text
TREE (left)         QUERY TAB (center, top)
─────────────────   ─────────────────────────────
▾ local FiveM       SELECT DATABASE();
  ▾ fivem
      players       [ F9 / blue play ▶ runs it ]
      characters
  ▸ information_schema
DATABASE()
fivem
Result grid (center, bottom). One row, one column: proof HeidiSQL is pointed at your fivem database.

How MariaDB and HeidiSQL relate (and why scripts care)

You installed two things that sound like one thing. They are not. Knowing which is which is the difference between fixing a database problem in ten seconds and uninstalling the wrong program at midnight.

MariaDB is the engine, HeidiSQL is the window

MariaDB is the database engine. It is a background Windows service with no real screen of its own. It listens on 127.0.0.1:3306. It holds your tables on disk. It answers the SQL it is handed. When you ran Get-Service MariaDB* in Step 5 and saw Running, that service is the engine doing its job whether or not any window is open.

HeidiSQL is a separate program. It connects to that engine and draws it for you: the session on the left, the database tree, the query editor, the result grid. Close HeidiSQL and your data is untouched, because the data never lived in HeidiSQL. It lives in MariaDB.

This is why the two install steps are separate. Step 5 installs the engine and proves it is running. Step 6 installs the window and proves it can see in. If HeidiSQL says "connection refused", the window is fine but the engine behind it is stopped. If HeidiSQL says "Access denied", the window reached the engine but handed it the wrong password.

How a script reaches the same database

Your FiveM scripts never open HeidiSQL, and they are not MariaDB either. They reach the engine through a third piece you install later as a resource: oxmysql, the community connector built by Overextended. You drop it into resources and ensure it in server.cfg. ensure is the server.cfg command that starts a resource. Then you point oxmysql at the same engine HeidiSQL connects to, using one convar.

A convar is a config value you set in server.cfg. The convar here is mysql_connection_string:

cfg
# server.cfg: oxmysql reads this convar, then your scripts query through it
set mysql_connection_string "mysql://root:YOUR_PASSWORD@localhost:3306/fivem"
ensure oxmysql

Read that string left to right. It is the same four facts you typed into the HeidiSQL session. User root. Your password. Host localhost (the same machine as 127.0.0.1). The fivem database.

One catch with this URI form. The oxmysql docs list characters to avoid in the password when you use it: ; , / ? : @ & = + $ #. If your root password contains any of those, switch to the semicolon form below (or change the password). The charset is handled by creating the database as utf8mb4, so you do not add a charset here.

The semicolon form avoids the problem entirely:

cfg
set mysql_connection_string "user=root;password=YOUR_PASSWORD;host=localhost;port=3306;database=fivem"

HeidiSQL connects so a human can look. oxmysql connects so scripts can read and write. Both knock on the same door at 127.0.0.1:3306. That shared door is the whole point of getting the database right now, before txAdmin or any framework asks for it.

So the chain a script follows is one hop longer than the one you do by hand:

text
You          -> HeidiSQL -> MariaDB (127.0.0.1:3306) -> fivem database
A FiveM script -> oxmysql  -> MariaDB (127.0.0.1:3306) -> fivem database

When you reach the hands-on lesson HeidiSQL hands-on, you will use that same window to import a framework's tables and browse player rows. Everything you build there is the human path into the engine your scripts hit through oxmysql.

HeidiSQL is closed, but your script still cannot read the database. Where is the problem most likely to be, and where is it definitely not?

Not in HeidiSQL. HeidiSQL is only a window for humans. Closing it changes nothing for scripts, because scripts go through oxmysql, not HeidiSQL. The problem is in the path your script actually uses. Either the MariaDB service is stopped (run Get-Service MariaDB* and confirm Running), or the mysql_connection_string in server.cfg has the wrong user, password, host, or database name. Both HeidiSQL and oxmysql hit the same engine at 127.0.0.1:3306. So if HeidiSQL can connect with a given user and password, point mysql_connection_string at exactly those values.

If something went wrong

SymptomFix
You saved server.cfg.txt instead of server.cfgTurn on File name extensions in File Explorer, then rename the file so it ends in .cfg with no .txt.
MariaDB installer says port 3306 is already in useAnother database is already on 3306. Open services.msc, find that service (or run Get-Service for MySQL or MariaDB), stop the conflicting one, then reinstall on port 3306.
MariaDB install fails with an errorYou are missing the Visual C++ Redistributable. Download VC_redist.x64.exe from Microsoft, install it, then run the MariaDB installer again.
HeidiSQL says Access denied for user 'root'The password is wrong. Retrieve it from your password manager. If it is genuinely lost, follow MariaDB's official password-reset procedure rather than reinstalling over data.
HeidiSQL says connection refusedThe MariaDB service is stopped. Run Get-Service MariaDB* and start it from Windows Services (services.msc) if it is not Running.
You created the fivem database but cannot see it in HeidiSQLHeidiSQL has not refreshed. Right-click the session at the top of the tree and choose Refresh, and the database appears.
HeidiSQL connects fine but a script later cannot reach the databaseScripts go through oxmysql, not HeidiSQL. Make the mysql_connection_string convar in server.cfg use the exact user, password, host, and database (fivem) that HeidiSQL connects with. Closing HeidiSQL never affects scripts.
The Cfx.re portal will not create a keyVerify your account email and sign in to portal.cfx.re with the same account. Try a private window if old cookies are stuck.

What you can do now

  • Use VS Code to edit .cfg and .lua files, with real file extensions visible.
  • Extract FiveM artifact archives with 7-Zip or WinRAR.
  • Generate a free Cfx.re license key from the portal and store it safely.
  • Run MariaDB as a service and confirm it with Get-Service MariaDB*.
  • Connect HeidiSQL to MariaDB and create the fivem database for txAdmin to use in Step 03.
  • Explain that MariaDB is the engine, HeidiSQL is the window humans look through, and oxmysql is the connector scripts use, all reaching the same database at 127.0.0.1:3306.

Try it yourself