Recent

Author Topic: what is required to connect to mariadb? - SOLVED  (Read 6393 times)

Michael Collier

  • Sr. Member
  • ****
  • Posts: 301
what is required to connect to mariadb? - SOLVED
« on: October 21, 2019, 10:22:12 pm »
I have:
lazarus 2.0.4
fpc 3.0.4
debian10
MariaDB 10.3.17-MariaDB-0+deb10u1

I'd like to connect from lazarus but can only see MySQL components (no mariaDB components), do I use MySQL components?

Also, do I need to install any client libraries? If so are they MySQL/MariaDB? Any links please?

The message I get when I attempt a connection using MySQL56 is cannot load default client library "libmysqlclient.so"

I have some client libraries installed, for Mysql and MariaDB, maybe I have the wrong ones?

I tried, for example, sudo apt-get install mariadb-client
and also from package manager installed "default-mysql-client" and "default-mysql-client-core"

Any help please?
« Last Edit: October 22, 2019, 06:31:27 pm by Michael Collier »

dogriz

  • Full Member
  • ***
  • Posts: 126
Re: what is required to connect to mariadb?
« Reply #1 on: October 22, 2019, 11:22:30 am »
Check your installed library version in /usr/lib/x86_64-linux-gnu/
You can create symlink to "libmysqlclient.so" if needed.
FPC 3.2.2
Lazarus 2.2.4
Debian x86_64, arm

Michael Collier

  • Sr. Member
  • ****
  • Posts: 301
Re: what is required to connect to mariadb?
« Reply #2 on: October 22, 2019, 03:47:57 pm »
ok thanks,
inside /usr/lib/x86_64-linux-gnu/
I have libmariadb.so.3
but no libraries with mysql name.. should there be?

dogriz

  • Full Member
  • ***
  • Posts: 126
Re: what is required to connect to mariadb?
« Reply #3 on: October 22, 2019, 04:59:42 pm »
Try with this command:
Code: [Select]
sudo ln -s /usr/lib/x86_64-linux-gnu/libmariadb.so.3 /usr/lib/x86_64-linux-gnu/libmysqlclient.so
FPC 3.2.2
Lazarus 2.2.4
Debian x86_64, arm

Michael Collier

  • Sr. Member
  • ****
  • Posts: 301
Solved-Re: what is required to connect to mariadb?
« Reply #4 on: October 22, 2019, 06:30:54 pm »
Thanks dogriz, it is connecting now, so if I understand correctly the code you sent created a link to the mariadb library (libmariadb.so.3) but with a mysql name (libmysqlclient.so) to trick the laraus component TMySQL56Connection into thinking it is using mysql. Hopefully this will help others in the future too, Cheers Mike.

LennartH

  • Newbie
  • Posts: 5
Re: what is required to connect to mariadb? - SOLVED
« Reply #5 on: October 24, 2019, 05:59:02 pm »
HI
Lazarus v2.0.0+dfsg-2 rdebian package 2.00....
Buster
Mariadb 10.3

I have same problem that I get a message "can not load libmysqlclient.so".
I found my file at /usr/lib/arm-linux-gnueabihf/libmariadb.so.3, I made a link as

sudo ln -s /usr/lib/arm-linux-gnueabihf/libmariadb.so.3       /usr/lib/x86_64-linux-gnu/libmysqlclient.so

but thas doesn't seem to work, I still get the same error.
I have no katalog /usr/lib/x86_64-linux-gnu  after installing Lazarus and Mariadb, Is this the rightplace also for Buster that see to be the only thing that differs from the other fellow? Another directory?
Is it possible to find where Lazarus expect the file to be placed?
 Best Rgds
Lennart from Sweden


Michael Collier

  • Sr. Member
  • ****
  • Posts: 301
Re: what is required to connect to mariadb? - SOLVED
« Reply #6 on: October 24, 2019, 08:08:56 pm »
I have same problem that I get a message "can not load libmysqlclient.so".
I found my file at /usr/lib/arm-linux-gnueabihf/libmariadb.so.3, I made a link as

sudo ln -s /usr/lib/arm-linux-gnueabihf/libmariadb.so.3       /usr/lib/x86_64-linux-gnu/libmysqlclient.so


Hi LennartH , I think for libmariadb.so.3 to work you must use TMySQL56Connection (the other components on my system would not connect), can you confirm which lazarus component you are trying to connect with please?

LennartH

  • Newbie
  • Posts: 5
Re: what is required to connect to mariadb? - SOLVED
« Reply #7 on: October 25, 2019, 08:24:15 am »
HI and Thanks for a very quick answer.

Yes, I changed to TMysql56Connection from 55 that I used  before when mysql was the default for Raspberry. I found that info on the net.
My link is as below, Right?

pi@raspberrypi:/usr/lib $ find -iname "libmysqlclient.so"
./x86_64-linux-gnu/libmysqlclient.so

Rgds
Lennart

dogriz

  • Full Member
  • ***
  • Posts: 126
Re: what is required to connect to mariadb? - SOLVED
« Reply #8 on: October 25, 2019, 09:08:54 am »
My link is as below, Right?

pi@raspberrypi:/usr/lib $ find -iname "libmysqlclient.so"
./x86_64-linux-gnu/libmysqlclient.so
On ARM Linux (RaspberryPi) path to symlink should be: /usr/lib/arm-linux-gnueabihf/
So, create it like this:
Code: [Select]
sudo ln -s /usr/lib/arm-linux-gnueabihf/libmariadb.so.3 /usr/lib/arm-linux-gnueabihf/libmysqlclient.so
FPC 3.2.2
Lazarus 2.2.4
Debian x86_64, arm

LennartH

  • Newbie
  • Posts: 5
Re: what is required to connect to mariadb? - SOLVED
« Reply #9 on: October 25, 2019, 10:40:11 am »
WOW, it worked. Thanks a lot, I realy appreciat your kind help.
I have been struggle with this for long time until I joined this forum.
How quick it was to get good help.
Many Thanks.
Rgds
Lennart

dogriz

  • Full Member
  • ***
  • Posts: 126
Re: what is required to connect to mariadb? - SOLVED
« Reply #10 on: October 25, 2019, 01:28:02 pm »
I think for libmariadb.so.3 to work you must use TMySQL56Connection (the other components on my system would not connect)
Yes, mysqlconn.inc looks like this:
Code: [Select]
...
  MariaDBVersion =
{$IFDEF mysql57}
    '10.1';
{$ELSE}
{$IFDEF mysql56}   // MariaDB 10.0 is compatible with MySQL 5.6
    '10.';
{$ELSE} // MariaDB 5.1..5.5 presumably report the same version number as MySQL
    MySQLVersion;
{$ENDIF}
{$ENDIF}
...
It is confusing if you use MariaDB... (I haven't checked for MySQL 8 )
Besides versioning, I'm not certain how compatible the latest versions of MariaDB/MySQL are with freepascal/lazarus database components because of their differences and new functionalities, but someone more knowledgeable might give an answer to that.
FPC 3.2.2
Lazarus 2.2.4
Debian x86_64, arm

 

TinyPortal © 2005-2018