[Release] FiveM MySQL - Standalone MySQL async library [Unstable/WIP]

FiveM MySQL - MySQL async library for FiveM [Unstable/WIP]

N|CoreV

Issues License Forks Stars

FiveM MySQL is a library written for FiveM and uses the mysql2 npm package to connect with your MySQL server. This library is similar and inspired by [Release] MySQL Async Library - 3.3.2.

You can find the project on GitHub: https://github.com/ThymonA/fivem-mysql

Current features

  • Async method for mysql by using a callback
  • Sync method also available but not recommended
  • uses mysql2 instead of mysql

Should I replace mysql-async with your fivem-mysql library?

Right now I don’t recommend to change those resources with each other, mysql-async is a stable MySQL library. Where fivem-mysql is a new library that may contain some bugs. Your free to try this resource out, but remember: It may contain bugs. You can report issues on GitHub: Report Issue.

When I think the resource is stable enough to be used on live servers, this notification will be removed and a post will be posted with a notification like: Ready for live servers :smiley:

Download

You can download the fivem-mysql.zip on GitHub under Releases or click the following link:
https://github.com/ThymonA/fivem-mysql/releases/latest

License

Project is written by ThymonA and published under GNU General Public License v3.0 Read License

Issues/Feature Requests

Feel free to create issues on GitHub with issues you occur or missing feature you’re like to see.
https://github.com/ThymonA/fivem-mysql/issues

Written by:
ThymonA // Tigo

GitHub: ThymonA
FiveM Forum: TigoDEV

READ:

16 Likes

And compared to mysql-async which is more?

I love to use MySQL 8, when I was using mysql-async I got those messages:

[mysql-async] [WARNING] It is recommended to run MySQL 5 or MariaDB with mysql-async. You may experience performance issues under load by using MySQL 8.

mysql-async is a really good resource to use and don’t say people have to change, especially not in there live versions right now because this resource may be unstable right now.

I decided to make an FiveM resource that uses a different library to connect with the database. I had performance improvements compared to the mysql-async library.

mysql-async

fivem-mysql

Currently, the performance of old databases does not seem to have increased but rather decreased.

People testing this library, thank you! You can report bugs/issues on GitHub and I’ll fix them as soon as possible.

3 Likes

mysql-async has right now more features and a custom NUI for debugging performance. fivem-mysql is right now a basic resource to communicate with your MySQL database.
I developed this resource for a MySQL 8 server and had a huge performance boost compared to the mysql-async library.

mysql-async

Performance test: `mysql-async`
Executing: 'SELECT * FROM `players`'
Query took: 0.073255ms to execute
Executing: 'SELECT * FROM `players` WHERE `name` = @name'
Query took: 0.091911ms to execute
Executing: 'INSERT INTO `players` (`identifier`, `name`, `group`, `job`, `grade`, `job2`, `grade2`) VALUES (@identifier, @name, @group, @job, @grade, @job2, @grade2)'
Query took: 0.101101ms to execute
Executing: 'DELETE FROM `players` WHERE `identifier` = @identifier'
Query took: 0.100100ms to execute

fivem-mysql

Performance test: `fivem-mysql`
Executing: 'SELECT * FROM `players`'
Query took: 0.029029ms to execute
Executing: 'SELECT * FROM `players` WHERE `name` = @name'
Query took: 0.051052ms to execute
Executing: 'INSERT INTO `players` (`identifier`, `name`, `group`, `job`, `grade`, `job2`, `grade2`) VALUES (@identifier, @name, @group, @job, @grade, @job2, @grade2)'
Query took: 0.061952ms to execute
Executing: 'DELETE FROM `players` WHERE `identifier` = @identifier'
Query took: 0.042152ms to execute
1 Like

MySQL 8 is much faster than any other version that was needed thx a lot <3

MySQL Performance Benchmarking: MySQL 5.7 vs MySQL 8.0 | Severalnines.

You can see details in here

I did my benchmark on the same SQL version 8.0, it isn’t that one was running on 5.4 or so.
fivem-mysql is faster compared to mysql-async when using MySQL 8.0

good release.

Does this work with JS scripts?

1 Like

can i make it use a different database (like for a certain script it will only use the database and the server the mysqlasync one)
an example instead of using:

set mysql_connection_string "....."

it will use

set mysql2_connection_string "..."

or a custom one

set scriptname_connection_string

can you make it also compatible with rd3 ?