mysql_ssl_set(3)
π mysql_ssl_set β bestie, let's lock it down π
okay so this is mysql_ssl_set(3) from the MariaDB Connector/C manual, and it's literally the glow-up button for your database connection. TLS? yes ma'am. let's go π¦
β¨ NAME β¨
mysql_ssl_set β sets TLS/SSL options π
πΈ SYNOPSIS πΈ
#include <mysql.h>
my_bool mysql_ssl_set(MYSQL *mysql,
const char *key,
const char *cert,
const char *ca,
const char *capath,
const char *cipher)
look at her. six args. main character energy fr. π
π DESCRIPTION π
so what this one does is set you up for establishing a secure TLS connection. that's the whole vibe. πβ¨
β οΈ but bestie, listen β you have to call it before you even think about touching mysql_real_connect(3). like, before. not during. not after. before. π
also, and this is important: TLS support has to be enabled in the client library for this function to do literally anything. if it's not enabled, you're just out here calling a function into the void. π
you can pass NULL for any parameter you're not using. and like, it always returns zero. always. zero. iconic consistency honestly.
want TLS but don't wanna mess with certificates at all? set every single value to NULL, like so:
mysql_ssl_set(mysql, NULL, NULL, NULL, NULL, NULL)
that right there is the same thing as:
mysql_optionsv(mysql, MYSQL_OPT_SSL_ENFORCE, &yes)
same energy, different font. periodt. π
π§ PARAMETER π§
mysqlβ a mysql handle, which was previously allocated bymysql_init(3). your lil baby connection object π«Άkeyβ path to the key file.certβ path to the certificate file.caβ path to the certificate authority file.capathβ path to the directory containing the trusted TLS CA certificates in PEM format.cipherβ list of permitted (SSLv3,TLSv1.0orTLSv1.2) cipher suites to use for TLS encryption.
π NOTES π
mysql_real_connect(3)will return an error if attempting to connect and TLS is incorrectly set up. so likeβ¦ set it up correctly. π- Even if Connector/C supports
TLSv1.3protocol, it is not possible yet to specifyTLSv1.3cipher suites via thecipherparameter. no cap, that's just where we're at. π₯²
π SEE ALSO π
mysql_get_ssl_cipher(3)β go peek at what cipher you ended up with π
Version 3.4 of the MariaDB Connector/C, bestie β that's the era we're living in. mwah, go encrypt something, i'm obsessed with you πβ¨π
π¦ 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