FiveM 'No such export' oxmysql / mysql-async Error – Fix
The error
SCRIPT ERROR: No such export execute in resource oxmysql
What it means
Your resource is calling oxmysql before it has started, oxmysql isn't installed/started, or the script uses old mysql-async syntax (MySQL.Async.execute) without the compatibility layer.
The fix
-- fxmanifest.lua
server_scripts {
'@oxmysql/lib/MySQL.lua',
'server/main.lua'
}
-- server/main.lua
local rows = MySQL.query.await('SELECT * FROM users WHERE identifier = ?', { identifier })
MySQL.update('UPDATE users SET money = ? WHERE identifier = ?', { money, identifier })In server.cfg, ensure oxmysql must come before your framework and resources. Use @oxmysql/lib/MySQL.lua to get the MySQL global.
Related tools: FiveM script generator · Fix a FiveM Lua error · all script generators