mysql_real_connect()

This establishes a connection to a MySQL database engine running on the specified host. Here is its syntax:

MYSQL *mysql_real_connect(MYSQL *mysqlObject, const char *hostName, const char *userid, const char *password, const char *dbase, unsigned int port, const char *socket, unsigned long flag)

Here:

The function returns a MYSQL connection handler if the connection is established; otherwise, it returns NULL.