mysql_init(3)
π mysql_init(3) π
okay bestie, welcome to the MariaDB Connector/C manual, page mysql_init(3). this is literally the very first thing you call before you do anything cute with a MySQL/MariaDB connection, so let's get into it π«Ά
β¨ NAME β¨
mysql_init β prepares and initializes a MYSQL structure. that's it, that's the job, and it does it flawlessly π
πΈ SYNOPSIS πΈ
#include <mysql.h>
MYSQL *mysql_init(MYSQL *mysql);
π¦ DESCRIPTION π¦
so like, mysql_init() prepares and initializes a MYSQL structure so it's ready to be used with mysql_real_connect(3). think of it as getting your little connection object dressed and ready for the main event β¨
and here's the cute part β it depends on what you pass in:
- if you passed the address of a
MYSQLstructure as the parameter, that structure gets initialized, no questions asked π - if you passed
NULL, a brand new structure gets allocated and initialized for you. slay, it does the memory work so you don't have to π
π Notes π
bestie, read these. they're lowkey important.
- if the parameter
mysqlis notNULL, themysql_close(3)API function will not release the memory π keep track of that yourself, no cap. - any subsequent calls to any function (except
mysql_optionsv(3)) will fail untilmysql_real_connect(3)was called. yeah, you heard me. don't go calling random stuff before you connect, it's giving impatience π - memory allocated by
mysql_init()must be freed withmysql_close(3). periodt. free your memory, it's the responsible main character move π
π RETURN VALUE π
mysql_init() returns the address of a MYSQL structure β¨ or NULL in case of a memory allocation error π (yes, that's a real thing that can happen, and now you know).
β SEE ALSO β
and that's the whole page bestie, you ate that π
this was Version 3.4 of the MariaDB Connector/C manual, page mysql_init(3) β mwah, go initialize something iconic πβ¨ππ¦πΈπ
π«Ά
π¦ where this page comes from
- alpine 3.22: mariadb-doc 11.4.13-r0 Β· GPL-2.0-or-later
- alpine 3.23: mariadb-doc 11.4.13-r0 Β· GPL-2.0-or-later
- alpine 3.24: mariadb-doc 11.8.9-r0 Β· GPL-2.0-only
- arch rolling: mariadb 13.0.2-2 Β· GPL-2.0-only
- arch rolling: mariadb-lts 12.3.3-2 Β· GPL-2.0-only
- centos-stream 10: mariadb-connector-c-doc 3.4.4-2.el10 Β· LGPL-2.1-or-later
- debian trixie: libmariadb-dev 1:11.8.6-0+deb13u1 Β· GPL-2.0-only
- fedora 43: mariadb-connector-c-doc 3.4.5-2.fc43 Β· LGPL-2.1-or-later AND PHP-3.0 AND PHP-3.01
- fedora 43: mariadb-connector-c-doc 3.4.9-2.fc43 Β· LGPL-2.1-or-later AND PHP-3.0 AND PHP-3.01 AND LicenseRef-Fedora-Public-Domain
- fedora 44: mariadb-connector-c-doc 3.4.8-3.fc44 Β· LGPL-2.1-or-later AND PHP-3.0 AND PHP-3.01
- fedora 44: mariadb-connector-c-doc 3.4.9-2.fc44 Β· LGPL-2.1-or-later AND PHP-3.0 AND PHP-3.01 AND LicenseRef-Fedora-Public-Domain
- nixpkgs unstable: mariadb-server 11.8.8
- opensuse-leap 16.0: libmariadb-devel 3.4.9-160000.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libmariadb-devel 3.4.9-160000.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libmariadb-devel 3.4.9-160000.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libmariadb-devel 3.4.9-160000.1.1 Β· LGPL-2.1-or-later
- ubuntu questing: libmariadb-dev 1:11.8.3-1build1
- ubuntu resolute: libmariadb-dev 1:11.8.6-5 Β· GPL-2.0-only
- ubuntu resolute: libmariadb-dev 1:11.8.6-5ubuntu0.1 Β· GPL-2.0-only
- ubuntu stonking: libmariadb-dev 1:11.8.9+ds-4ubuntu2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms