Migrate from mysql-async to oxmysql
mysql-async and ghmattimysql are deprecated. We explain how to move your queries to oxmysql, the standard, maintained connector.
The problem
You have resources that use `MySQL.Async.*` (mysql-async) or `exports.ghmattimysql` and you want to move them to oxmysql, which is what's maintained today.
The cause
mysql-async and ghmattimysql are no longer maintained. oxmysql is faster, asynchronous and supports await. Change the exports and how you pass parameters.
The solution
Replace the old syntax with oxmysql's (parameters with `?` instead of `@var`):
lua
-- Before (mysql-async)
MySQL.Async.fetchAll('SELECT * FROM users WHERE identifier = @id', {
['@id'] = identifier
}, function(result) end)
-- Now (oxmysql), with callback
MySQL.query('SELECT * FROM users WHERE identifier = ?', { identifier }, function(result) end)
-- Now (oxmysql), with await inside a thread
local result = MySQL.query.await('SELECT * FROM users WHERE identifier = ?', { identifier })Step by step
- 1.Put `ensure oxmysql` before your resources in server.cfg.
- 2.In the fxmanifest add `server_script '@oxmysql/lib/MySQL.lua'`.
- 3.Change `@name` parameters to `?` in order.
- 4.Replace `MySQL.Async.fetchAll/fetchScalar/execute` with `MySQL.query/scalar/update`, or use `.await` in threads.
Related guides
Last updated: 2026-06-17. Crxative-M is not affiliated with Cfx.re or Rockstar Games.
