RazzorFlame RazzorFlame - 8 months ago 42
Linux Question

Do I need original mysql library to run MySQL C++ Connector

I have quick yes/no question. Till this moment I wrote my code using original libmysql.dll but it turns out that it is not available on Linux (correct me if I am wrong). So I read that MySQL C++ Connector is available on Linux as well. I need to write my code multi-platform because it is server that need to run on Windows and on Linux.

The question: Is MySQL C++ Connector without any other additions ready to use to connect to my database? If not -> what libraries should I also download?


Yes, you need that library, but it ships with the connector:

To use the static Connector/C++ library, link against two library files, libmysqlcppconn-static.a and libmysqlclient.a. The locations of the files depend on your setup, but typically the former are in /usr/local/lib and the latter in /usr/lib. The file libmysqlclient.a is not part of Connector/C++, but is the MySQL client library file distributed with MySQL Server. (Remember, the MySQL client library is an optional component as part of the MySQL Server installation process.) The MySQL client library is also available as part of the Connector/C distribution.


Anyway, you didn't actually need to switch libraries, because libmysql.dll is the Windows shared library for Connector/C which, like Connector/C++, is certainly also available on Linux and many other operating systems. You just need to download the correct binary for your platform.

Simply visit the project webpage for all the details and downloads you could ever need: