Separate connection failure from query failure
When a FiveM server cannot talk to its database, every script that depends on stored players, vehicles, money, inventories or jobs can start throwing confusing follow-up errors. The first job is to decide whether oxmysql failed to connect at all or whether a specific query failed after the connection was already working. A connection failure usually appears during server startup and mentions credentials, host, access denied, unknown database, timeout or connection refused. A query failure usually mentions a table, column or SQL statement.
Do not begin by editing random QBCore or ESX scripts. If the database layer is not connected, script patches cannot fix the real issue. Copy the first database error, the relevant server.cfg lines and the oxmysql start order. Keep passwords out of public screenshots. If you need AI help, replace the password with a placeholder but keep the host, database name format and error wording visible.
set mysql_connection_string "mysql://user:PASSWORD@host/database?charset=utf8mb4"
ensure oxmysql
ensure qb-core
ensure my_custom_resourceCheck the connection string carefully
The most common mistakes are a wrong database name, wrong username, wrong password, wrong host or importing SQL into a different database from the one in the connection string. If the host panel creates a database called s12345_qbcore but your connection points at qbcore, the server will connect to the wrong place or fail entirely. If the MySQL user exists but does not have permission for that database, you may see access denied even though the password is correct.
Check one thing at a time. Confirm the host address, then the username, then the database name, then the password, then the port if your host uses a non-standard port. Restart after changes. If the connection works but scripts still fail, move to table and column errors. Those are schema problems, not connection problems.
Start oxmysql before framework resources
Framework resources need the database early. oxmysql should start before qb-core, ESX and custom resources that load player data. If qb-core starts before the database resource, player loading and economy systems can fail before the server settles. Put database and framework dependencies in a clear order and avoid scattering ensures across multiple config files unless you know exactly how your host merges them.
If txAdmin or a host recipe controls startup, inspect the final generated server.cfg. Sometimes a recipe installs oxmysql but the custom script is inserted above it later. A clean order makes debugging easier because the database is ready before scripts ask for data.
Use AI to compare the evidence
Stellar AI can help when you paste the exact database error, connection-string shape, start order, affected resource and SQL file. Ask it to identify whether the issue is credentials, database selection, dependency order or schema. The right answer should give you a small test plan: start oxmysql, confirm no connection error, start the framework, join with one test player, and trigger the resource that previously failed.
After fixing the connection, test persistence. Change one small value such as cash, garage state or inventory, leave, rejoin and confirm it remains. That proves the server is not only connected but also writing to the expected database.
Fix it without guessing
Paste the safe version of your database error and startup order into Stellar AI. It can turn the console output into a step-by-step patch and private-server test.
Open Stellar AI free →