It has been experienced that the MySQL Client layer (libmysql.dll 5.x or 6.x) may cause an error when used repetitively (such as 1.000 times) by the same process. A simple workaround to avoid such an error is to allocate the LIBMYSQL dll once in the project initialization code, before accessing the database.
sDllMySQL is string = "LibMySQL.DLL"
nInstanceMySQL is int = LoadDLL(sDllMySQL)
IF nInstanceMySQL=0 THEN
EndProgram("Error loading LIBMYSQL", ErrorInfo())