Set up a FiveM database by installing a supported MariaDB release, creating a dedicated application schema and account, importing the framework’s reviewed schema and configuring its supported connector before dependent resources start. Keep database access private. When queries are slow, correlate application timing with database evidence rather than assuming every connector warning means the database hardware is inadequate.
Choose versions from the framework requirements
Confirm the framework/resource releases and their supported database connector before installation. Overextended’s documentation describes the original project’s discontinuation and subsequent community maintenance; record the actual repository and release you use instead of assuming an old download remains maintained. Check the framework’s current guidance for that combination.
1. Provision a private database
- Install MariaDB through its supported operating-system procedure or use an appropriate managed database.
- Bind to local/private connectivity where possible and permit only the application hosts that need access. Do not expose the database publicly to simplify a connection test.
- Create the application schema with the character set/collation expected by the framework.
- Create a dedicated runtime account scoped to that schema and connection source. Grant the operations the application needs; use a separately controlled migration account if broader schema changes are required.
- Record versions and recovery credentials securely, then take a baseline backup before importing custom data.
Account identity can include the connection host. A user that works through a local socket may not match a TCP connection from another host. Test the same endpoint and transport that the connector will use before changing firewall or grants.
2. Configure startup order and credentials
For a compatible oxmysql deployment, set the connection string before starting the connector and start it before framework resources. Use the format supported by the installed release. Do not place the connection string in a replicated or public server-information variable, and do not copy an example root account into production.
# server.cfg: placeholders only; use your connector-supported secret format
set mysql_connection_string "user=APP_USER;password=APP_SECRET;host=127.0.0.1;port=3306;database=APP_DATABASE"
ensure oxmysql
# Start the selected framework and dependent resources afterward.Special characters need the connector’s documented handling for the chosen format. Keep this configuration out of public source control and redact it from support logs. Import installation SQL once into a test schema first; understand whether a migration deletes, overwrites or transforms existing records.
3. Verify persistence, not only connectivity
- Start privately and inspect connector/framework errors.
- Create a test character or another supported application record.
- Save, disconnect and restart cleanly, then confirm the same state loads.
- Take a matched file/database backup and rehearse restoring it into an isolated target before relying on scheduled backups.
How to investigate a slow-query warning
| Evidence | Next investigation |
|---|---|
| One query pattern is repeatedly slow | Execution plan, filters, joins, indexes and result size |
| Many unrelated queries slow together | Connections, lock waits, storage latency and host load |
| Only startup is slow | Migrations, cold caches and resource initialization |
| Warnings align with FXServer hitches | Application scheduling and the server profile alongside database timing |
Enable a bounded slow-query logging interval using the variable names for your MariaDB version. Record the previous settings and restore them afterward. Logs may contain player identifiers or values; restrict access and retention. Avoid enabling unbounded full-query logging on a busy production server.
Use EXPLAIN to inspect a representative statement’s planned access path. Runtime analysis variants can execute the statement, so understand the exact command before using it, especially with writes. Test index or query changes against representative data and preserve result correctness; a faster incorrect query is not an improvement.
Use FiveM recovery before schema changes and hitch diagnostics for correlated server work. Compare FiveM hosting with database access, location and recovery needs included.
Sources and references
Hosting documentation. Publication and update dates reflect this edition.
Related articles
- How to Back Up and Restore a FiveM Server and DatabaseProtect resources, txAdmin profiles and SQL state as one recoverable set, then prove the restore on an isolated instance.4 min read
- How to Install FiveM Resources and Fix Startup ErrorsCheck resource layout, manifests, dependencies and database steps before adding an ensure entry to your server configuration.4 min read
- How to Diagnose FiveM Server Hitch WarningsCapture the right profiler trace, separate server work from client FPS, and test resource changes without guessing.3 min read
