3

I am moving from mysql to MariaDB. With mysql I was linking the C connector to my application with mysql_config --libs, and according to what I can read on internet it should still be possible with MariaDB, but on my system mysql_config does not exist and I do not know how to get it and if the copy I will eventually get will be still compatible with MariaDB.

So the question is: how to link MariaDB to my C/C++ application?

Debian 10 (Buster) 64 bits ~

mariadb-server Version: 1:10.3.15-1 ~

mariadb-client Version: 1:10.3.15-1 ~

Thank you in advance.

susenj
  • 342
  • 1
  • 4
  • 12
beddu
  • 71
  • 9

3 Answers3

2

Well, this is what I do:

sudo apt-get install libmariadbclient-dev

And the link command will be -lmariadbclient

Sharath
  • 1,627
  • 2
  • 18
  • 34
  • Thanks. With some investigation, starting from your answer, I found out this: https://packages.debian.org/buster/libmariadb-dev - It should be the one! – beddu Jul 27 '19 at 20:49
1

To avoid naming collisions with either MySQL or MariaDB Servers prior to 10.2 (MariaDB Connector/C is bundled with Server since 10.2) MariaDB Connector/C doesn't have the mysql_config script anymore, instead of please use mariadb_config.

Georg Richter
  • 5,970
  • 2
  • 9
  • 15
0

On my system I had installed only mariadb-server and mariadb-client, so mariadb_config was not present and mysql_config is not used anymore.

I found out that I need to install also libmariadb-dev which pulls in mariadb_config and all the headers and libs necessary to compile and link my application.

Many thanks to Georg and Sharath who gave me the right hints to find the solution.

beddu
  • 71
  • 9