[How-to] Setup FXServer with MySQL and Essentialmode4

Can someone please send me essential*mode. I’ll syd

1 Like

Hey, it’s probably outdated but i’ll give it a shot.
Everytime I log in in my ES2 server, it gives me an error in the console which says:
Scriptenvironment::TriggerEvent: Error executing event handler for event playerConnecting in resource essentialmode: an exception has been thrown by the target of an invocation and my Users table stays empty.
I am currently using Wamp as a MySQL manager which works for other addons requiring it.

I will not send you any files or link any kind of download for the old essential*mode files. It’s not my work and I don’t have permission to do that.

1 Like

I’ve updated the guide hopefully this solves a lot of the basic issues people keep having.

1 Like

how can I test the mysql connection?

i always get an error that my user var = nil :confused:

i get cant load esplugin_mysql when i try joing my server. any ideas how to fix it?

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

Can you maybe tell us how to do that? Thank you!

That line is basically useless and I wouldn’t worry about it now. When this guide was written there were a lot of scripts designed for only MySQL compatibility. Then another developer pushed one of the most popular frameworks to require couchdb. Some scripts could work on both couchdb and MySQL but you had to edit a line that told it to use the specific database.

So for example the original Cops FiveM resource was compatible with both MySQL and CouchDB
This is from the Cops FiveM resource.
In the config_db.lua you had to edit the following lines

db = {
	driver = "mysql-async",
	--[[
	* "mysql-async" : use a beta mysql library (it's in beta test so it can have some issues, please report any problem here : https://forum.cfx.re/t/beta-mysql-async-library-v0-2-0/21881)
	* "couchdb" : use db system support by essentialmode >= 3(nosql)
                All features aren't compatible with couchdb because there are a lot of dependencies and I won't upgrade others scripts to couchdb.
				You have to see with others author to upgrade their scripts to CouchDB if you want all feature compatible with CouchDB
				/!\ESSENTIALMODE IS REQUIRE IF YOU USE THIS DATABASE/!\
	]]
	
	--CouchDB credentials (if you are using couchdb ofc)
	couch_ip = "127.0.0.1",
	couch_port = 5984,
	couch_auth = "root:password" -- "user:password"
}

So where it says this line of code:

db = {
	driver = "mysql-async",

That is where you would tell it to use mysql-async or switch it to use couchdb
These directions vary for every resource, you just need to look for the ‘database = mysql-async’ somewhere in the config.
Cops FiveM is no longer compatible with couchdb
Most resources aren’t designed for couchdb anymore.

1 Like

I’m gettin this error in the console:

[ERROR] An error happens on MySQL for query “SELECT * FROM items {=}”: Unable to connect to any of the specified MySQL hosts.

Follow your steps tons of times but I still can’t figure it out, please help.
Of the database is st up correctly, but what’s that so?!

How do you specify it to essentialmode, because i did put it into the server.cfg but my server is still trying to connect to couchdb …

hey there when im try to join the server its says failed to load resorce chat

When i connect to my server I get this error https://pastebin.com/x6FMmfxW. If I could get some help with this it would help me a lot.

Does this not work with Essential5? I keep getting this error message

Access denied for command add_principal.

You did not setup Essentialmode 5 correctly, follow the instructions provided in the original topic.

As a side note; Essentialmode 5 does not support MySQL.

I figured…
So it’s impossible to run Essential Mode with ESX at this moment? As ESX doesn’t support CouchDB. And Essential Mode doesn’t support MySQL.

I used to host and mod my own GMod and Rust servers and I’m a webdeveloper, so I’m not totally new to databases or LUA. But for some reason I just cant get anything but vRP to work… Seems like everyhing is incompatible with eachother at the moment, if you don’t use older versions of everything that is nearly impossible to find. Maybe I’m just stupid…

Normally I would never correct a moderator. But I’m running es5.0 and esx. Kanersps made an SQL plugin, it can be found in the es release thread.

And you never got this error? Or do you know what I’m doing wrong?

Access denied for command add_principal.

Did you do the same as in this guide, just with the newest version?

I’ve finally gotten Es4 working with MySQL. But I would rather use the newest version of course.

Thanks a lot. Seems like a fix and not something that’s intended? Is this really all that’s making it incompatible?

As far as I know. I’ve been away from fivem for awhile. Came back about a month ago. I never used es4.0. I was using es2.0 on the cfx came back to the fx server and started using es5.0 with esx.

1 Like