mariadb-connector-c-install

Installs and configures MariaDB Connector/C across Linux distributions and source builds.

28|115|Updated Jan 28, 2025
One-click install
npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-connector-c-install-mariadb-corporation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mariadb-connector-c-install
Source: https://github.com/mariadb-corporation/mariadb-docs/tree/main/agent-skills/granular/connectors/mariadb-connector-c-install
Command: npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-connector-c-install-mariadb-corporation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Installing and configuring MariaDB Connector/C trips up developers because package names differ per distribution, compile flags get hardcoded incorrectly, and the library silently ignores option files unless the application explicitly opts in. This Skill provides the correct package names, flag discovery methods, and option-file semantics so C applications compile, link, and connect as expected. ## Core Features & Use Cases - Distribution-specific installation: Correct runtime and development package names for Debian/Ubuntu (libmariadb3/libmariadb-dev), RHEL/Rocky/SLES (MariaDB-shared/MariaDB-devel), plus source-build prerequisites with CMake. - Compile and link flag discovery: Uses mariadb_config --cflags --libs or pkg-config libmariadb instead of hardcoded include paths and the wrong -lmysqlclient library name. - Option-file configuration guidance: Explains that mysql_real_connect() reads option files only after mysql_optionsv() with MYSQL_READ_DEFAULT_FILE or MYSQL_READ_DEFAULT_GROUP, which groups are read, and TLS option availability per build library. - Use Case: A developer on Ubuntu compiles a C application against MariaDB, gets linker errors from hardcoded flags, then finds connections ignore /etc/my.cnf. This Skill resolves both by switching to mariadb_config output and adding the required mysql_optionsv() call. ## Quick Start Ask the AI to install MariaDB Connector/C development packages on your distribution and show how to compile a C application with the correct flags and enable option-file reading.

Frequently Asked Questions about mariadb-connector-c-install

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I install MariaDB Connector/C on Ubuntu or Debian?▼

Install MariaDB Connector/C on Debian or Ubuntu with `sudo apt install libmariadb3 libmariadb-dev` after configuring the MariaDB repository. The development package is required for compiling since the runtime package alone has no headers or `mariadb_config`.

How to compile a C application against MariaDB Connector/C?▼

Compile with `gcc app.c $(mariadb_config --cflags --libs) -o app` or use pkg-config module `libmariadb`. The library is `-lmariadb`, not `-lmysqlclient`, and include paths vary per distribution, so never hardcode them.

Why does MariaDB Connector/C ignore my.cnf option files?▼

Connector/C ignores option files unless the application calls `mysql_optionsv()` with `MYSQL_READ_DEFAULT_FILE` or `MYSQL_READ_DEFAULT_GROUP` before connecting. Command-line clients read them because they opt in; your application must do the same explicitly.

Which option groups does MariaDB Connector/C read?▼

Connector/C reads `[client]`, `[client-server]`, and `[client-mariadb]`, plus one custom group named via `MYSQL_READ_DEFAULT_GROUP`. Precedence follows the order sections appear in the file, not the order of group names.

Do all ssl options work in every MariaDB Connector/C build?▼

No, available TLS options depend on the library the connector was built against. `ssl-capath` and `ssl-crlpath` need OpenSSL, `ssl-crl` needs OpenSSL or Schannel, and `ssl-passphrase` needs OpenSSL or GnuTLS.

Does MariaDB Connector/C support .mylogin.cnf credential files?▼

No, MySQL's obfuscated `.mylogin.cnf` credential file is not supported by MariaDB Connector/C. Credentials must be passed programmatically or stored in standard option files like `~/.my.cnf`.