You are here : cpp0mysql_connect

mysql_connect() - 0

 This function is deprecated. Use
        mysql_real_connect() instead.mysql_real_connect()mysql_real_connect()mysql_connect() attempts to
        establish a connection to a MySQL database engine running on
        host.
        mysql_connect() must complete
        successfully before you can execute any of the other API
        functions, with the exception of
        mysql_get_client_info().mysql_connect()mysql_connect()hostmysql_connect()mysql_connect()mysql_get_client_info()mysql_get_client_info()The meanings of the parameters are the same as for the
        corresponding parameters for
        mysql_real_connect() with the
        difference that the connection parameter may be
        NULL. In this case, the C API allocates
        memory for the connection structure automatically and frees it
        when you call mysql_close(). The
        disadvantage of this approach is that you cannot retrieve an
        error message if the connection fails. (To get error information
        from mysql_errno() or
        mysql_error(), you must provide
        a valid MYSQL pointer.)mysql_real_connect()mysql_real_connect()NULLmysql_close()mysql_close()mysql_errno()mysql_errno()mysql_error()mysql_error()MYSQL


Syntax

MYSQL *mysql_connect(MYSQL *mysql, const char *host,
        const char *user, const char *passwd)


Example

 


Output / Return Value

 Same as for
        mysql_real_connect().mysql_real_connect()mysql_real_connect()


Limitations


Alternatives / See Also


Reference