Name

mysql_get_host_info( )

Synopsis

char *mysql_get_host_info(MYSQL *mysql)

This returns the hostname and the connection type for the current connection.

...
MYSQL *mysql;
mysql = mysql_init(NULL);
mysql_real_connect(mysql,"localhost","marie","password",
                   NULL,0,NULL,0);
printf("Host Info: %s \n", mysql_get_host_info(mysql));
mysql_close(mysql);
...

The results of this program excerpt will look something like the following:

Host Info: Localhost via UNIX socket

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.