[Help] My FXServer not talking to my SQL

I’m having huge issues getting my FXServer to talk to the SQL,

I get this error when i launch the server :
[ERROR] [MySQL] An error happens on MySQL for query “SELECT * FROM items”: ER_DBACCESS_DENIED_ERROR: Access denied for user ‘’@‘localhost’ to database ‘erver=127.0.0.1;database=essentialmode;userid=root;’
Error running call reference function for resource es_extended: citizen:/scripting/lua/scheduler.lua:351: server/common.lua:27: attempt to get length of a nil value (local ‘result’)
stack traceback:
server/common.lua:27: in upvalue ‘ref’
citizen:/scripting/lua/scheduler.lua:337: in function citizen:/scripting/lua/scheduler.lua:336
[C]: in function ‘xpcall’
citizen:/scripting/lua/scheduler.lua:336: in function citizen:/scripting/lua/scheduler.lua:335
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:351: in function citizen:/scripting/lua/scheduler.lua:322
Error: Unhandled error Error: BUFFER_SHORTAGE
at n.e [as reserve] (citizen:/scripting/v8/msgpack.js:29:12766)
at h (citizen:/scripting/v8/msgpack.js:29:15761)
at n.r [as decode] (citizen:/scripting/v8/msgpack.js:29:13908)
at n.fetch (citizen:/scripting/v8/msgpack.js:29:6972)
at n.u [as read] (citizen:/scripting/v8/msgpack.js:29:12076)
at Object.n [as decode] (citizen:/scripting/v8/msgpack.js:29:7097)
at unpack (citizen:/scripting/v8/main.js:20:33)
at citizen:/scripting/v8/main.js:48:11
at setImmediate (mysql-async.js:5039:9)
at Object.callback (citizen:/scripting/v8/timer.js:56:6)

Tried everything i can think of. My Server.cfg has the correct SQL details:

set es_enableCustomData 1
set mysql_connection_string “server=127.0.0.1;database=essentialmode;userid=root;”

Anything ideas?

You are using the new mysql-async 3.0.0

you need to use a different connection string, in your case:

set mysql_connection_string “mysql://root@localhost/essentialmode?dateStrings=true”
1 Like

Thanks got me one step closer now i get this:
[ERROR] [MySQL] An error happens on MySQL for query “SELECT * FROM items”: ER_NO_DB_ERROR: No database selected
Error running call reference function for resource es_extended: citizen:/scripting/lua/scheduler.lua:351: server/common.lua:22: attempt to get length of a nil value (local ‘result’)
stack traceback:
server/common.lua:22: in upvalue ‘ref’
citizen:/scripting/lua/scheduler.lua:337: in function citizen:/scripting/lua/scheduler.lua:336
[C]: in function ‘xpcall’
citizen:/scripting/lua/scheduler.lua:336: in function citizen:/scripting/lua/scheduler.lua:335
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:351: in function citizen:/scripting/lua/scheduler.lua:322
Error: Unhandled error Error: BUFFER_SHORTAGE
at n.e [as reserve] (citizen:/scripting/v8/msgpack.js:29:12766)
at h (citizen:/scripting/v8/msgpack.js:29:15761)
at n.r [as decode] (citizen:/scripting/v8/msgpack.js:29:13908)
at n.fetch (citizen:/scripting/v8/msgpack.js:29:6972)
at n.u [as read] (citizen:/scripting/v8/msgpack.js:29:12076)
at Object.n [as decode] (citizen:/scripting/v8/msgpack.js:29:7097)
at unpack (citizen:/scripting/v8/main.js:20:33)
at citizen:/scripting/v8/main.js:48:11
at setImmediate (mysql-async.js:5039:9)
at Object.callback (citizen:/scripting/v8/timer.js:56:6)
My Server.cfg is:

set mysql_connection_string “mysql://root@localhost/essentialmode?dateStrings=true”
set es_enableCustomData 1
start mysql-async
Huge thanks again, ive been working on this for weeks now.

ask this question in the original ESX topic.

I guess your database essentialmode does not exist.

1 Like

i can see it in hedi
image

It’s like it can’t access it even though it’s there

try creating a user that is not root e.g. with

grant all on essentialmode.* to 'esxuser'@'localhost' identified by 'password';

in heidisql and then change the connection string acordingly.

mysql://esxuser:password@localhost/essentialmode?dateStrings=true

No same error:
[ERROR] [MySQL] An error happens on MySQL for query “SELECT * FROM items”: ER_NO_DB_ERROR: No database selected
Error running call reference function for resource es_extended: citizen:/scripting/lua/scheduler.lua:351: server/common.lua:22: attempt to get length of a nil value (local ‘result’)

Which mysql/mariadb version are you using?

Please move into the sql thread or es thread, that way the resource creators get notified and helps keep everything in the one spot so others can easily have access to the current problem and can better troubleshoot it in other situations.

Thanks.

Mysql/MariaDB 10.1.35

Seem to solve the error by changing server_script in the resource.lua to ‘@mysql-async/lib/MySQL.lua’ from the mysql-async.js. it is not causing other problems but i’m going to end this thread and join the mysql. Thanks for all your help

1 Like

I have the same problem can you tell it in more detail?

I’m still having a problem so i have got a solution yet sorry. for some reason the fivem server can’t get authorisation to access the mysql database. getting some people with more knowledge than me to look at it.

Im stuck please explain this ive been up all night its 10am now and i still haven’t fixed it

If you are stuck at the last error he has. Just make sure mysql-async gets started first.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.