mysql_init
mysql_init allocates and initializes a MYSQL structure for use with mysql_real_connect, and also initializes the thread subsystem if not already done.
Syntax
MYSQL * mysql_init(MYSQL * mysql);Parameter
mysql- a pointer toMYSQLorNULL. In case of passing aNULLpointer mysql_init() will allocate memory and return a pointer to a MYSQL structure.
Description
Prepares and initializes a MYSQL structure to be used with mysql_real_connect().
mysql_init() also ensures the client library is initialized, via a one-time internal initialization; it does not depend on mysql_thread_init(), which is a no-op retained for compatibility.
Return Value
The mysql_init() function returns an address of a MYSQL structure, or NULL in case of memory allocation error.
See Also
This page is: Copyright © 2026 MariaDB. All rights reserved.
Last updated
Was this helpful?

