Name

mysql_get_server_version( )

Synopsis

unsigned long mysql_get_server_version(MYSQL *mysql)

This returns the version of the server for the current connection in a numeric format. For example, for Version 4.1.7, the function will return 40107.

...
MYSQL *mysql;
mysql = mysql_init(NULL);
mysql_real_connect(mysql,"localhost","root","password",
NULL,0,NULL,0);
printf("Server Version: %ul \n",
        mysql_get_server_version(mysql));
mysql_close(mysql);
...

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.