I am still flumoxxed by trying to connect.
You say you're using MariaDB 12.3.2
Why are you using libmysql.dll? I note my instance of MariaDB (10.11.8 ) ship with libmariadb.dll for connection instead.
Just try point to that DLL
uses
mysql80conn;
begin
InitialiseDBLib('C:\MyApp\libmariadb.dll');
MySQL80Connection1.HostName := 'localhost';
MySQL80Connection1.DatabaseName := 'mysql';
MySQL80Connection1.UserName := 'user';
MySQL80Connection1.Password := 'password';
MySQL80Connection1.Connected := True;
end;
Update: I'm troubleshooting this - not working for me either.
Update2: I'm now reproducing OP's reported issue, just with different version numbering. Which makes sense, I'm using an older DLL.
I need to recompile fpc with debug info. Unfortunately, I'm out of time. I'll try this tomorrrow.
But this is all bringing back memories for me. I couldn't get this to work in the past either. It's why I use ZeosDB for MariaDB. I really should document these decisions.
My code in case anyone wants to pick this up:
Uses
mysql80conn, mysql80dyn, sqldb;
{$R *.lfm}
{ TForm1 }
Procedure TForm1.Button1Click(Sender: TObject);
Var
Conn: TMySQL80Connection;
Tran: TSQLTransaction;
Begin
Conn := nil;
Tran := nil;
Try
InitialiseMysql('B:\Apps\Dev\UniserverZ_mariaDB\core\mysql\bin\libmariadb.dll');
Conn := TMySQL80Connection.Create(nil);
Tran := TSQLTransaction.Create(nil);
Conn.Transaction := Tran;
Tran.DataBase := Conn;
Conn.HostName := 'localhost';
Conn.DatabaseName := 'mysql';
Conn.UserName := 'root';
Conn.Password := 'password';
Conn.Port := 3306;
Caption := Conn.ClientInfo; // debug only. I'm getting 3.3.10
Conn.SkipLibraryVersionCheck := True; // comment this out and get a version clash. Uncomment this and get "could not connect"
Conn.Open;
ShowMessage('Connected successfully');
Conn.Close;
Except
on E: Exception Do
ShowMessage(E.ClassName + LineEnding + E.Message);
End;
Tran.Free;
Conn.Free;
End;