FiveM5 minutes
Connecting MySQL Database
How to connect your server to database for data storage
Storing player info, money, and properties requires a database. oxmysql is currently the standard and fastest option.
- 1Step 1
Create Database
Access phpMyAdmin and create a new database (e.g., fivem_server). Remember the name.
- 2Step 2
Download oxmysql
Download the latest oxmysql and put it in resources. Ensure it starts before any script needing data.
- 3Step 3
Setup Connection String
In server.cfg, add the connection line: set mysql_connection_string 'server=localhost;database=fivem_server;userid=root;password=yourpassword'
- 4Step 4
Import Tables
If using a Base pack, import the included .sql file into your database.
Database Tips
- Always use oxmysql instead of the old mysql-async for better performance.
- Ensure no extra spaces in the connection string.
- Backup your database regularly.
- Protect your database with a strong password and don't share it.
Need help?
Contact SupportDatabase connection issues?
