Rechercher dans le manuel MySQL
28.7.7.7 mysql_connect()
MYSQL *mysql_connect(MYSQL *mysql, const char *host,
const char *user, const char *passwd)
Description
This function is deprecated. Use
mysql_real_connect()
instead.
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()
.
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.)
Same as for
mysql_real_connect()
.
Same as for
mysql_real_connect()
.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-mysql-connect.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.