mysql_get_server_version()
unsigned long mysql_get_server_version(MYSQL *mysql)
This function 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. Here is an example:
...
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);
...