MySQL 8.0 Reference Manual Including MySQL NDB Cluster 8.0

28.7.1 MySQL C API Implementations

The MySQL C API is a C-based API that client applications written in C can use to communicate with MySQL Server. Client programs refer to C API header files at compile time and link to a C API library file, libmysqlclient, at link time.

To obtain the C API header and library files required to build C API client programs, install a MySQL Server distribution.

You can install a binary distribution that contains the C API files pre-built, or you can use a source distribution and build the C API files yourself.

The names of the library files to use when linking C API client applications depend on the library type and platform for which a distribution is built:

On Unix, you may also see libraries that include _r in the names. Before MySQL 5.5, these were built as thread-safe (re-entrant) libraries separately from the non-_r libraries. As of 5.5, both libraries are the same and the _r names are symbolic links to the corresponding non-_r names. There is no need to use the _r libraries. For example, if you use mysql_config to obtain linker flags, you can use mysql_config --libs in all cases, even for threaded clients. There is no need to use mysql_config --libs_r.