[How-to] Setup FXServer with MySQL and Essentialmode4

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:\Users\Server\Desktop\FXServer
C:\Users\Server\Desktop\FXServer\run.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:\Users\Server\Desktop\FXServer 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:\Users\Server\Desktop\FXServer\resources\esplugin_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.

45 Likes

XAMPP works too and is a lot easier to install and manage, good tutorial!

6 Likes

Thanks I was actually looking for different workbenches maybe we can put a list together and I’ll update the guide so people have better options.

Good idea, the only one I really know though is XAMPP, mainly because it’s all I’ve ever used and it’s portable too.

thank you so much for the guide,ive been working with it all day trying to get my server using it. however,i only seen cash icon appear once after i started the game the first time, i never got /login anytime i join either. im still trying to find away to get this up and going, im trying xampp now, but i still cant figure this out.

WolfKnight could you please do a xampp tutorial as well, it would be nice to have another option or something to compare it to.

i can join my server with no issues, the very first time i did, i seen cash $0 in upper right hand corner of game screen when i joined. I thought everything was working,but i tried commands and nothing worked.then restarted fivem server and tried again and nothing works other than i can join the server. so,out of frustration, i tried to do all this again thru xampp thinking maybe it would be easier,and i cant get anything to work. sorry for bad English,not my first language

Of course, once you’ve downloaded XAMPP control panel, open it and you should see a window with two services (or more). Click ‘Start’ next to apache and MySQL.

Once you’ve done that click on the ‘Admin’ button next to the MySQL start button. You will be greeted by the ever so awesome phpMyAdmin page, look in the top left for a button that says ‘New’ and click it.

Once you’ve clicked new, type in the name for the database below, and make sure it is a collation, then click create.

A new page will load, click the ‘Import’ button at at the top.

Here you will see a ‘Choose File’ button, click that and browse to the sql.sql file that comes with EssentialMode, should be in the .zip file.

Once you’ve down that, two tables should then be in the database.

It should work now with the help of @TrundleTheGreat

5 Likes

Hello ,

For me all work good but when I make /setmoney command I have message in game, money add in database but when I return in game the money is $0 again??? @Kanersps dont give solution so maybe you know what’s problem?

My release about this Essentialmode

And my topic for problem about money

Hope you can help me! :sweat_smile:

1 Like

IF I understand this correctly. YOu install some sort of mysql dashboard, import the sql database. So once that is done, can you then upload it to a server? I’m talking about the essential’s scripts. I have a server through a gaming server company ,so it’s not on my computer. Any help would be welcome.

Hi, i have an error when i start the server :

Someone can tell me how to set properly the password on xampp ?

I had changed the

MySQL:open(“127.0.0.1”, “gta5_gamemode_essential”, “root”, “password”)

and the password on my.ini from xampp

I changed the gamemode and added

- essentialmode
- es_admin

to the xitmp-server.yml

Please can someone help me ?

Sorry for my bad english

1 Like

Once you upload the script edit the “fiverebornserver”\resources\essentialmode\server\player\login.lua with your own sqldatabase info.

If you’re using XAMPP, it runs with no password which means that you should be able to leave the password field empty and it would work just fine. Make sure to also revert the changes made on your my.ini and restart the service through the XAMPP Control Panel.

Otherwise if you are super into using a secure way, you can generate a new Account on the index of phpmyadmin and grant permission to the table and also give your user a password.

1 Like

Thanks dude, it is what i did and worked fine

Hello, i did all that Trundle The Great said, but in game i don’t have any jobs or whatever i should have in the RP Server, how can i active all of that, i really want to have a server with jobs, money system and other interactions
Please if you can help me…
(sorry for bad english i’m still learning it)

Hello, Jobs and other stuff you can find in the Release page. Just download them add them to the resources and dont forget to add the lines in citmp-server.yml and you should be all set.

Where can I download the es_ admin? Because link is broken for me and I could download only the essentia lmode. Anyone can help or upload the file?

can someone help me set it up nothing works

Does anyone have the sql.sql file? Can’t seem to find it.

Does anyone know where you can find the original or older version of essential mode files. This new system is good but none hardly any of the releases are supported. If anyone know where you can find the files please let me know. Thanks

Good job but i have a problem.
I have errors in my logs for citizen.

Look my screen.

I have a solution please ?
Thanks

1 Like