Name
mysql_real_connect
Synopsis
MYSQL *mysql_real_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, uint port, const char *unix_socket, uint client_flag)
Creates a connection with a MySQL database server. There are eight arguments to this function:
An initialized
MYSQL
structure, created withmysql_init
.The hostname or IP address of the MySQL database server (use an empty string or
localhost
to connect to the local MySQL server over a Unix socket).The username used to connect to the database server (an empty string may be used assuming the Unix login name of the person running the client).
The password used to authenticate the given user. If an empty string is used, only users with no passwords are checked for authentication.
The initial database selected when you connect (an empty string may be used to not initially choose a database).
The port used to remotely connect to a MySQL database server over TCP (0 may be used to accept the default port).
The filename of the Unix socket used to connect to a MySQL server on the local machine (an empty string may be used to accept the default socket).
Zero or more of a set of flags used under special circumstances:
CLIENT_FOUND_ROWS
When using queries that change tables, returns the number of rows found in the table, not the number of rows affected.
CLIENT_NO_SCHEMA
Prevent the client from using the full
database.table.column
form to specify a column from any database.CLIENT_COMPRESS
Use compression when ...
Get MySQL and mSQL 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.