🛢️MySQL Connection String
Creating your database is 1 thing, but connecting your database to your server is another, below are a few steps on how to connect your fivem server to your mysql database.
Creating your connection string:
Visit the MySQL String Generator Website: Here
Click
Next
twice until you are on3: Configure the FXServer
.

After you are on the 3rd page, scroll down until you see this:

The following information will be required for your connection string to work: (Some other things you can add will be: acquireTimeout and connectTimeout - These will make the string take longer before connecting / pushing an error.)
User
database
host
password

After filling out the info regarding your database and you should see a section called
FXServer Configuration
Copy the line shown below from the website and paste it into your server.cfg and restart your server

Ensuring oxmysql or mysql-async
Whether you use oxmysql or mysql-async the way you ensure the it matters.
Put the following lines of code into your server.cfg below all the default resources required by FiveM.
set mysql_connection_string "host=localhost;user=root;database=fivem"
ensure mysql-async -- Only if using mysql-async
ensure oxmysql -- Only if using oxmysql
Congratulations, you connected your database to your FiveM Server!
Last updated
Was this helpful?