[Release] MySQL Async Library - 3.3.2

Hey so I’m confused with this configuration thing for the FX, do you use config.lua? Or is there a line in a file I’m not seeing that I have to configure?

I confirm I have the same error :

I18N: System.IO.FileNotFoundException: Unable to find the specified file.

Have you made sure to configure the server.cfg? Also when you run any async scripts most will not work, you will have to re-script alot> Remember, FX server does not support require "resources/mysql-async/lib/MySQL"

Hello bravo for your job
I have errors at startup
https://gyazo.com/6c0d0b51aa50821c6bf173f46803dabe

I put the convar in the server.cfg
https://gyazo.com/4dd65732d7db1814812bb0f5d55a8019

I really feel that it does not find the connection identifiers for the data base
Someone could tell me or I’m wrong
thank you in advance

I just updated the fxserver version, see the changelog in the top post to see what’s change.

I also add a upgrading guide to the 2.0 version https://github.com/brouznouf/fivem-mysql-async/blob/master/UPGRADING.md

Please note that a bug was fixed in fivem today which was the source of some nil reference and others bugs reported here as well, so it’s heavily recommended to upgrade your server to the last version of fxserver.

Feel free to raise issue on the github, will try to answer it at the best i can during my free time.

Cheers

1 Like

I’ll try the new update out soon and report back you’re a godsend :slight_smile:

What is wrong with the query?

MySQL.Async.fetchScalar("SELECT COUNT(1) FROM ephone_users WHERE playerid = @identifier", {['@identifier'] = GetPlayerIdentifiers(source)[1]}, function(data)
      RconPrint("checked")
 end)

It just doesn’t do anything, tried with fetchAll too.

EDIT: Seems like the variable name data is used somewhere else.

I would think you would want do something with the variable “data” once you execute that query. Like set it equal to a local variable and trigger something with it?

At least that’s how i understand what you’d be using a fetch for.

Beta 3 Released

Changelog

  • Complete rewrite, should be more stable and faster for async version
  • Add mysql_debug convar (default to false) true = print query statements
  • Add insert methods which allow to execute a query and return the last insert id from the database
  • Add a vstudio project, to give more trust about what is done and allow better contribution
  • Update to last version of the underlying lib

Don’t use beta 3 it’s broken !

Beta 4 released

  • Fix hard bug with fields and value being null cause of using IsDbNullAsync
  • Better exception message
  • Better error detection
  • Now show parameters in the log

Previous not for Beta 3:

It is now FULLY Async, before only the query execution was async, now it’s everything when using Async functions (Opening connecting, Query Execution and Result reading are async)

Using currently on FX 300+ and no issues with beta 4 currently. Again thanks for your work man :slight_smile:

Beta 5 and 6 (use beta 6 for linux, 3 - 5 have file name problem)

  • Pooling no more forced to false and true by default

https://gyazo.com/c737284b1e0444b8f60d6856c815cbee
Please help anyone

Please help anyone

Of course, i must be superman or something like this …

What i am sure is that your system which has the hostname ‘Europian_rolepay’ is not allowed to connect to your MySQL

For this i must be “SUPER READER MAN” …

A last help from “SUPER USER GOOGLE MAN” : http://lmgtfy.com/?q=host+is+not+allowed+to+connect+to+this+mysql+server

I’m using the beta 6 as of right now on Centos 7

I’m getting this error

[ERROR] [] An error happens on MySQL for query "SELECT * from vex_users {=}": Unable to connect to any of the specified MySQL hosts

The connection string is as follows

set mysql_connection_string "server=127.0.0.1;database=MYDB;userid=root;password=MYPASSWD"

Code that’s being run

AddEventHandler('onMySQLReady', function ()
	MySQL.Async.fetchAll('SELECT * FROM vex_users', {}, function(result)
		print(result)
	end)
end)

From centos I can connect to the DB aswell as from phpmyadmin - so i assume its a bug?

Not necesseraly, maybe your phpmyadmin connect through the mysql socket and not 127.0.0.1 and root is only able to connect from mysql socket given yours permissions.

Try “localhost” instead of 127.0.0.1, or try the command line : mysql -u root -h 127.0.0.1 -p MYDB

Tried with 127.0.0.1 in command line and it did not work, however localhost did.

On the server I tried both, and they don’t work.

Mysql client understand localhost as the mysql socket, not sure the underlying lib that i use do that, update your permissions for your root user and you should be fine.

Cheers, found the problem. My bind-address was set to my public IP instead of 127.0.0.1.

That issue was resolved, however another issue arrised.

Same examples used as above but this is the stacktrace.

[ERROR] [] An critical error happens on MySQL for query "SELECT * FROM vex_users {=}": libmono-btls-shared   at (wrapper managed-to-native) Mono.Btls.MonoBtlsSslCtx:mono_btls_ssl_ctx_new ()
  at Mono.Btls.MonoBtlsSslCtx..ctor () [0x00000] in <89d8686f8abb4ad4924b7ba149cbbb2a>:0 
  at Mono.Btls.MonoBtlsContext.InitializeConnection () [0x00000] in <89d8686f8abb4ad4924b7ba149cbbb2a>:0 
  at Mono.Btls.MonoBtlsContext.StartHandshake () [0x00000] in <89d8686f8abb4ad4924b7ba149cbbb2a>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncProtocolRequest asyncRequest, Mono.Net.Security.AsyncOperationStatus status) [0x00004] in <89d8686f8abb4ad4924b7ba149cbbb2a>:0 
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (Mono.Net.Security.AsyncOperationStatus status) [0x0006b] in <89d8686f8abb4ad4924b7ba149cbbb2a>:0 
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation () [0x0000d] in <89d8686f8abb4ad4924b7ba149cbbb2a>:0 
  at Mono.Net.Security.AsyncProtocolRequest.StartOperation () [0x00000] in <89d8686f8abb4ad4924b7ba149cbbb2a>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.EndProcessAuthentication (System.IAsyncResult result) [0x00064] in <89d8686f8abb4ad4924b7ba149cbbb2a>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.EndAuthenticateAsClient (System.IAsyncResult asyncResult) [0x00000] in <89d8686f8abb4ad4924b7ba149cbbb2a>:0 
  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x00019] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at MySql.Data.Serialization.MySqlSession+<InitSslAsync>d__63.MoveNext () [0x003cf] in <15d7165346914936bcd75d2d106a8749>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at MySql.Data.Serialization.MySqlSession+<ConnectAsync>d__52.MoveNext () [0x00467] in <15d7165346914936bcd75d2d106a8749>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at MySql.Data.MySqlClient.ConnectionPool+<GetSessionAsync>d__0.MoveNext () [0x00498] in <15d7165346914936bcd75d2d106a8749>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at MySql.Data.MySqlClient.MySqlConnection+<OpenAsync>d__17.MoveNext () [0x000cb] in <15d7165346914936bcd75d2d106a8749>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <d7e663f2f7cd4ab6929018ec5233f09d>:0 
  at MySQLAsync.Operation`1+<ExecuteAsync>d__3[TResult].MoveNext () [0x000aa] in <9048c170cf4a46e5b48177b4eb7409e1>:0 

Maybe this library (libmono-btls-shared) is missing, don’t know i tested it on arch linux / windows with no problem