Error

oxmysql won't connect / connection string error

If oxmysql won't start or throws a connection error, it's almost always the connection string. Here's the correct format.

The problem

oxmysql doesn't start, or you see "unable to connect" / "error parsing" errors and no resource that uses the database works.

The cause

The `mysql_connection_string` is malformed, the credentials are wrong, the database doesn't exist, or oxmysql loads after the resources that use it.

The solution

Use this exact format in server.cfg (adjust user, password and database):

cfg
set mysql_connection_string "mysql://user:password@localhost/your_database?charset=utf8mb4"

# oxmysql must load BEFORE any resource that uses the DB
ensure oxmysql
ensure es_extended

Step by step

  1. 1.Verify that the database exists and that the user/password are correct.
  2. 2.Don't add stray spaces or quotes inside the string; use the URI format.
  3. 3.Put `ensure oxmysql` before es_extended and the rest of the resources.
  4. 4.Store credentials in secrets.cfg if your server is public (don't push them to git).

Different case?

Paste your error in the AI tool and get the fix instantly.

Try the tool

Related guides

Last updated: 2026-06-15. Crxative-M is not affiliated with Cfx.re or Rockstar Games.

oxmysql won't connect: fixing the connection string in FiveM