Shopping Cart
FiveM script 11abac85b780a6bfb422bb414511bacab31e72a7

[How-to] Setup FXServer with MySQL and Essentialmode4 – Server Tutorials


This guide will help you setup:

  1. FXServer and how to configure it for SQL/Essentialmode4
  2. MySQL for Windows
  3. Serverstarter.bat file
  4. Installing Essentialmode4
  5. Installing MySQL-Async
  6. Installing esplugin_mysql
  7. importing a .sql database into your MySQL Server

Download the MySQL Community edition from here from the windows mysql installer or just google ‘Download SQL Community Edition’

In that link there are two options, use the top one its 1.7mb and is an auto-installer just keep everything default. It might ask what MySQL tools you want to install. I clicked full install, it might ask you to install python you can ignore it. In the end it will want you to install the example sql files I just canceled the setup for that and moved on you don’t need it.

This link was pretty helpful with pictures but kinda dated, the MySQL Server + MySQL Workbench is recommended if you choose custom install. This is a step-by-step guide for the install

There are lots of different MySQL ‘workbench’ apps that create an easy to use interface for viewing and managing your SQL database. I HIGHLY recommend you install the MySQL workbench included with the installer or get your own, you won’t have to use that windows CMD console to manage your stuff as pictured in the guide.

Now that MySQL is installed we have some ground work to take care of before we can get our server launched and essentialmode running. If you already have FXServer running you can skip this part of the guide.

Get the latest FXServer here is the link to the Windows Server Download

Lets create a .bat file so we can easily start our server and load resources.
I use Notepad++ for this I recommend you download that too.

  1. Make a new text file
  2. Save it as .bat file | File > Save As> Save As Type: All Files (All Types .)
  3. File Name: serverstarter.bat
  4. Click save
  5. Go to your new .bat file, right click and edit it with notepad++
  6. Paste this text and then paste your FXServer file location into the text.
cd C:UsersServerDesktopFXServer
C:UsersServerDesktopFXServerrun.cmd +exec server.cfg

Once that is pasted in, save the file and now double click the “serverstarter.bat” file to boot your server.
Again, C:UsersServerDesktopFXServer is my FXServer file location, you need to replace this with the file path YOU have FXServer installed to.

Now we need to create a server.cfg file so we can tell the server our settings and what resources to start up.
Go here and copy+paste the server.cfg that the devs were kind enough to supply us with.
Make sure the server.cfg file is in your FXServer folder.

Boot your server up so it creates the citizen, resources, and cache folders in your FXServer folder.
If you double click the serverstarter.bat file and it flickers but nothing happens you need to read my instructions again.


Now that we have a running server we can get essentialmode installed on it.
Download the latest essentialmode from the forums here.

  1. Extract the .rar so we can access the ‘essentialmode’ folder and ‘es_admin2’ folder.
  2. Paste the ‘essentialmode’ folder into your FXServer/resources folder.
  3. Paste the ‘es_admin2’ folder into your FXServer/resources/[essential] folder. If that doesn’t exist see step 4.
  4. If there is no ‘[essential]’ folder just make a new folder and name it [essential] with the brackets, then paste the ‘es_admin2’ folder into it. So it should be FXServer/resources/[essential]/es_admin2 as the final file path.
  5. Edit your server.cfg file and add start essentialmode and start es_admin2
    It should look like this:
# Starting server basics
start mapmanager
start chat
start spawnmanager
start fivem
start hardcap
start ■■■■■■■
start scoreboard

# Starting Essentialmode
start essentialmode
start es_admin2

You shouldn’t need to edit anything inside the essentialmode .lua files. We are almost done but now we need to install and configured mysql-async before we can use the essentialmode-MySQL_plugin.


Download MySQL-Async-Library from the FiveM Forums
mysql-async-library for fxserver

  1. Extract the folder and it should be named ‘fivem-mysql-async-2.xx’
  2. Rename the folder from ‘fivem-mysql-async-2.xx’ to mysql-async this is very important!
  3. We need to edit our server.cfg file again so open that again.
  4. Paste the following into your server.cfg file:
set mysql_connection_string "server=127.0.0.1;database=essentialmode;userid=root;password=PASSWORD"

# Initialize System Main Files
start mapmanager
start chat
start spawnmanager
start fivem
start hardcap
start ■■■■■■■
start scoreboard

# Starting Mysql-async
start mysql-async
start essentialmode
start es_admin2

This will enable mysql-async and tell it to use our essentialmode database in MySQL.
Be sure to replace password=PASSWORD with your password!


 set mysql_connection_string "server=127.0.0.1;database=essentialmode;userid=root;password=YourPassword"

^^^ This line is very important, you need to place this above essentialmode stuff and your system main files.

That’s all we will need for mysql-async, now we will download the plugin for essentialmode that enables it for MySQL and we can get our database imported.


Download esplugin_mysql from the forums you may need to scroll down to where it says “Custom data plugins”

Make sure you have MySQL-Async installed and working before installing esplugin!
esplugin_mysql for essentialmode

  1. Extract the file so we can access the esplugin_mysql file
  2. Paste the esplugin_mysql file into your FXServer/resources folder
  3. Edit your server.cfg file with the following info
set es_enableCustomData 1
set mysql_connection_string "server=127.0.0.1;database=essentialmode;userid=root;password=PASSWORD"

# Initialize System Main Files
start mapmanager
start chat
start spawnmanager
start fivem
start hardcap
start ■■■■■■■
start scoreboard

# Starting Mysql-async
start mysql-async
start essentialmode
start esplugin_mysql
start es_admin2

we added set es_enableCustomData 1 to the top of our server.cfg
and we added the start esplugin_mysql

We just need to import the .sql database and your server should be ready to go!

Now open your MySQL server through the MySQL Workbench (has a dolphin icon) you can import the ‘.sql’ script that comes with the esplugin_mysql download. Follow this youtube video to import the script into your sql database. Be sure to click refresh to see that your SCHEMAS has been updated after running the script.

The .sql file is located in the esplugin_mysql folder
C:UsersServerDesktopFXServerresourcesesplugin_mysql
If it asks you to name the database you can leave it blank and the script should name it essentialmode automatically. If the database won’t name itself then call it essentialmode


That’s it you’re done, if you were switching from couchdb you may need to tell your scripts to use mysql-async


This is not a help thread, you won’t recieve support here if something is wrong. This is merely a guide to help out people who are new to setting up servers and installing these resources. Always go one step at a time, test each new resource one at a time, and always make a backup before you make edits.
If something is wrong with my tutorial let me know and I can fix it.



Premium ESX Scripts? Click here!

Leave a Reply
FiveM ESX Scripts

The best scripts and maps

Best support

Problems? We are there to help!

Wide range of products

We have a wide range of products

100% Secure Checkout

Stripe

About

Are you creating a FiveM server? Here are the best scripts for it – for a cheap price and a very good quality! Don’t waste time testing and fixing free scripts. Use our premium FiveM scripts.

ESX Scripts is a Network for FiveM Scripts | FiveM Store | FiveM Mods | FiveM Scripts | FiveM EUP | FiveM Cheats | FiveM AntiCheats | FiveM Vehicles | FiveM Cars | FiveM Maps | FiveM Discord | FiveM Clothes | FiveM Launcher | FiveM Servers | FiveM.NeT | FiveM | FiveM RP | FiveM RolePlay | FiveM USA | FiveM Europe | FiveM EU | roleplay store | Role Play | RP | RP Server | FiveM Asia | FiveM World | FiveM Servers | FiveM Tools FiveM Hosting | FiveM Shop | CitizenFX Collective | FiveM CFX, ESX Scripts A global network that aims to strengthen fivem.net roleplay servers. And it’s just to improve the quality of the servers.  We hope we can get your opinion just to improve the quality of your server. You can get maps, vehicles, scripts, eup, tools, etc… right on our shop website!

Help

Need help with a product? Our sellers offer good support. Free for you! Click here to get help.

Are you a creator?

We are looking for people that want to sell their scripts and maps (of FiveM) in our store. Click here to register and sell.