[Release] MySQL Async Library - 3.3.2

where can i delete the command mysql_connection_string

Please could someone help me ?
its a VPS with Ubuntu 20.04 and mysql 8
[mysql-async] [ERROR] ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

@StonebridgeGR ```
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’

so i have to change my mysql password?

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

i’m sorry right but do you not know how to use google, literally all you have to do is copy paste the error into google and you get the answer, if you are unable to fix basic mysql issues then you arn’t going to do very well with a server. This is what is wrong with this platform, too many stupid ‘devs’ not willing to learn and just copy pasting stuff.

already fixed it relax man!!

Noob dev here. My server fequently crashes and gives players messages like this (image from a player who crashed)

Have I done something wrong with my db?

i am getting some exact error, most of my players. any sollution?

can I use js with this script?

It would be really cool if this supported the JSON data type but unfortunately it only delivers mangled, unusable Lua tables instead of usable ones.

The async result is a table that contains the requested result in subtable (confirmed through encoding the subtable with an external JSON script). In order to obtain the subtable, I need to access result[1], which returns nil ONLY for result[1][1] and has no other data at any other address. Using json.encode(result[1]) allows me to /view/ the JSON data that I need to access, but as that result is a string and not an array of three specific values as was inserted into the database column in the first place, this is an aberrant outcome.

Do you intend to properly support JSON data types or should I just hack a JSON->Lua table script into mysql-async for personal use and call it a day?

You’ve cut out all of the actual data that anyone can use to determine what the issue is and what needs to be done to solve it. Go back and get more information about the errors from the console and post those - a picture of your computer monitor displaying the error message in FiveM is of little to no use (and you should have screenshot that anyway).

Right, for anyone who wants to use the JSON data field in your MYSQL table, here’s what I had to do to get access to the values of the column:

Do your select column from table where othercolumn = whatever fetchall, then take the returned results and decode them, then access results[“column”] to get the string value of the contents. Then you decode the string value, and now you have your Lua table containing the contents - you can access parts of that by using the correct identifiers.

EDIT: If you have multiple levels of depth to your JSON, you may need to invoke decode a few more times.

For me, getting the first row in an array stored in a JSON field from the results of the query looks like this:
EDIT: json.decode((json.decode(json.encode(result[1])))[“column”])[1]

1 Like

I have the same question yeah

1 Like

Oh you can use javascript with this script!

On Lua Its

MySQL.Async.execute("DELETE FROM users", {}, function(result)

end)

On Javascript Its

exports['mysql-async'].mysql_execute(`DELETE FROM users"`, [], result => {
            
})

You Can Check All The Exports On mysql-async/lib/MySQL.lua

Funnily enough, this is the only error that I have is all of these slow query warnings

Thank you!

The creators will have to comment on this but you’re not using an approved database / a database that’s been benchmarked and I suspect that you’re encountering issues because of that. It’s very likely that you will experience fewer issues if you downgrade to MariaDB 10.3 or 10.4.

Add this to your server.cfg

set mysql_slow_query_warning 10000

how do we optimize tables? can you give an example please?

 [MariaDB:10.4.18-MariaDB] [WARNING] [DP_Inventory] [1068ms] SELECT * FROM ammunition : []
[  script:mysql-async] [MariaDB:10.4.18-MariaDB] [WARNING] [esx_addonaccount] [1067ms] SELECT * FROM addon_account : []
[  script:mysql-async] [MariaDB:10.4.18-MariaDB] [WARNING] [es_extended] [433ms] SELECT * FROM items : []
[  script:mysql-async] [MariaDB:10.4.18-MariaDB] [WARNING] [es_extended] [433ms] SELECT * FROM jobs : []