Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 38.1Mb
PDF (A4) - 38.1Mb
PDF (RPM) - 37.3Mb
HTML Download (TGZ) - 10.2Mb
HTML Download (Zip) - 10.3Mb
HTML Download (RPM) - 8.9Mb
Man Pages (TGZ) - 217.0Kb
Man Pages (Zip) - 329.9Kb
Info (Gzip) - 3.5Mb
Info (Zip) - 3.5Mb
Excerpts from this Manual

MySQL 5.7 Reference Manual  /  ...  /  mysql_get_client_version()

27.8.7.28 mysql_get_client_version()

unsigned long mysql_get_client_version(void)

Description

Returns an integer that represents the MySQL client library version. The value has the format XYYZZ where X is the major version, YY is the release level (or minor version), and ZZ is the sub-version within the release level:

major_version*10000 + release_level*100 + sub_version

For example, "5.7.21" is returned as 50721.

The function value is the version of MySQL or Connector/C that provides the client library. For more information, see Section 27.8.4.5, “C API Server and Client Library Versions”.

Return Values

An integer that represents the MySQL client library version.

Errors

None.


User Comments
  Posted by Wolfgang Rohdewald on April 28, 2005
4.0.24 does not have it for the embedded library.
4.1.0 does not have it at all.
4.1.1 does have it for all library versions.

  Posted by SBF SBF on August 25, 2017
If you want to print it, you can use something like this:

unsigned long mysql_version = mysql_get_client_version();
std::cout << "\tMySQL V"
<< mysql_version / 10000 << "." // major
<< mysql_version / 100 % 100 << "." // minor
<< mysql_version % 100 << // build
<< std::endl;
Sign Up Login You must be logged in to post a comment.