I use the UDF from Prog@ndy and have no issues https://www.autoitscript.com/forum/index.php?showtopic=85617
; (put libmysql.dll and mysql.au3 into the sktipt directory)
#include ".\mysql.au3"
Func _connectDB()
Local $DB_HOST = "xxxxx"
Local $DB_PORT = "12345"
Local $DB_DATABASE = "dddddd"
Local $DB_USER = "uuuuuu"
Local $DB_PASS = "pppppp"
_MySQL_InitLibrary()
If @error Then Return SetError(1, 0, 0)
Local $connection = _MySQL_Init()
If $connection = 0 Then Return SetError(2, 0, 0)
Local $connected = _MySQL_Real_Connect($connection, $DB_HOST, $DB_USER, $DB_PASS, $DB_DATABASE, $DB_PORT)
If $connected = 0 Then Return SetError(3, 0, 0)
Return SetError(0, 0, $connection)
EndFunc
Func _disconnectDB($connection)
_MySQL_Close($connection)
_MySQL_EndLibrary()
EndFunc ;==>_CloseDatabase