Forum > Database
Connecting to MariaDB on XAMPP
(1/1)
HappyLarry:
I have XAMPP running on Linux. XAMPP is installed (automatically) at /opt/lampp/. I have libmysqlclient18 5.6.3 installed. XAMPP has MariaDB as part of it but Iunderstand that is fully compatible with sqldb and mysql.
I also have a database called DB on it. The database user name is 'root' and it has no password as is standard for XAMPP. The database functions correctly and I can see the database through localhost/phpmyadmin. I am trying to connect Lazarus to it.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button1Click(Sender: TObject); begin MySQL56Connection1.Hostname := 'localhost'; MySQL56Connection1.DatabaseName:='DB'; MySQL56Connection1.UserName:='root'; MySQL56Connection1.Transaction:=SQLTransaction1; SQLTransaction1.Database:=MySQL56Connection1; SQLQuery1.Database:=MySQL56Connection1; SQLQuery1.Transaction:=SQLTransaction1; SQLQuery1.SQL.Text:='SELECT * FROM MyTable'; Datasource1.dataset:=SQLQuery1; DBGrid1.DataSource:=DataSource1; MySQL56Connection1.Open; If MySQL56Connection1.Connected then begin Label1.caption:='connected'; end;end;
I get an error Server connect failed'. Can anyone see what I am doing wrong? I suspect it is the database name but I don't know what I should put instead.
HappyLarry:
A bit more information:
In XAMPP, mysql is found at
/opt/lampp/bin
and I have changed my .bashrc file with
PATH=${PATH}:/opt/lampp/bindb
so that if I type
mysql -u root
anywhere then mysql (MariaDB) opens successfully. Unfortunately when Lazarus tries to connect, I still get the same error.
rsouza:
You also need to put the libs folder in your .bashrc.
Navigation
[0] Message Index