FiveM
Server
Windows
Database setup

Database

In this guide I will be explaining how to install MariaDB in combination with HeidiSQL to manage your server's database.

MariaDB

Download MariaDB

  • Download MariaDB from the official website (opens in a new tab)
  • Select MariaDB Server Version 11.4.4
  • Select "Windows" as "Operating System"
  • The website should now look like this
  • Leave the "mirror" default
  • Press "Download"

Install MariaDB

Now that we have installed the MSI file, its time to install the application.

  • Run the MSI file
  • Press next
  • Tick the box for License Agreement and press next
  • Leave the settings default, press next
  • You can either choose to untick the box to continue without a password or create a password, that is up to you. If you have done that press Next again
  • Leave all the settings default and press next
  • Press "Install"
  • If your computer asks you "Do you want this app to make changes to your device" click "Yes".
  • Once that is done you should be able to click "Finish".
  • To make sure that MariaDB is properly installed, we will go to services.msc and look for "MariaDB"
  • If you followed all these steps, MariaDB should be present in the services like this

HeidiSQL

HeidiSQL is used to view and manage the database.

Download HeidiSQL

Install HeidiSQL

  • Open the .exe file we just installed.
  • Select the option for I accept the agreement and press next.
  • Leave the destination Location default and press next.
  • Press next again on the Select Start Menu Folder option.
  • For the Select Additional Tasks you can decide what options you want to turn on. Press next again.
  • Press "Install"
  • Click "Finish"

Optional

Connect to the server and create a database

  • Open HeidiSQL once the installation is complete
  • In the bottom left, click on "New"
  • Now enter the connection details as follows:
    • Hostname / IP: If you installed MariaDB on the same machine as HeidiSQL, leave it as 127.0.0.1. If not, enter the public IP of the machine where MariaDB is installed (Port Forwarding needed) click here (opens in a new tab) to learn how to portforward.
    • User: Leave as root
  • Press "Open"
  • Right click the server in the top left (usually Unnamed) and press "Create new -> Database"
  • Enter the name of the database and press "OK"

Add the database to your FiveM server

  • Open your server.cfg file
  • Add one of the following lines to the file (above ensure oxmysql):
set mysql_connection_string "mysql://root:PASSWORD@localhost:3306/DATABASE_NAME"
set mysql_connection_string "user=root;password=PASSWORD;host=localhost;port=3306;database=DATABASE_NAME"
  • Replace PASSWORD with the password you set during the MariaDB installation and DATABASE_NAME with the name of the database you created in HeidiSQL
  • Save the file and restart your server