MYSQL_CONFIG(1)

πŸ“¦ version 9.7.2_2, in arch rolling

πŸ’… NAME (aka what even is this)

mysql_config β€” the little script that spills the tea on all the options you need to compile clients 🫢

So like, welcome to the mysql_config(1) page, bestie β€” the manual for the MySQL Database System, and honestly? She's serving utility.


✨ SYNOPSIS ✨

mysql_config options

That's it. That's the whole vibe. You pass it options and it tells you stuff. πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so picture this: mysql_config hands you all the useful info you need for compiling your MySQL client and connecting it to MySQL. She's literally your compiler's bestie. πŸŽ€

Real talk though β€” she's a shell script, so she only exists on Unix and Unix-like systems. No cap. If you're on something else, this is not the page for you, sorry not sorry. 😭

πŸ’€ Note: pkg-config can be used as an alternative to mysql_config for obtaining information such as compiler flags or link libraries required to compile MySQL applications. For the full scoop, see Building C API Client Programs Using pkg-config[1] down in NOTES.

mysql_config supports the following options, and yes I'm listing every single one because we don't skip. πŸ‘‘

  • --cflags β€” C Compiler flags to find include files, plus the critical compiler flags and defines used when compiling the libmysqlclient library. Lowkey important caveat: the options returned are tied to the specific compiler that was used when the library was created, and they might clash with the settings for your own compiler. πŸ™ˆ If you want something more portable that contains only include paths, use --include instead.
  • --cxxflags β€” Like --cflags, but for C++ compiler flags. Same energy, different language. ✨
  • --include β€” Compiler options to find MySQL include files. This is the chill, portable one. 🌸
  • --libs β€” Libraries and options required to link with the MySQL client library.
  • --libs_r β€” Libraries and options required to link with the thread-safe MySQL client library. But here's the thing: in MySQL 9.7, all client libraries are thread-safe, so this option need not be used. The --libs option can be used in all cases. Periodt. πŸ’…
  • --plugindir β€” The default plugin directory path name, defined when configuring MySQL.
  • --port β€” The default TCP/IP port number, defined when configuring MySQL.
  • --socket β€” The default Unix socket file, defined when configuring MySQL.
  • *--variable=var_name* β€” Display the value of the named configuration variable. The permitted var_name values are pkgincludedir (the header file directory), pkglibdir (the library directory), and plugindir (the plugin directory). Pick your fighter. 🧚
  • --version β€” Version number for the MySQL distribution.

🌈 no options? no problem

If you invoke mysql_config with no options at all, it just dumps a whole list of every option it supports, with their values. It's giving "here's my whole personality in one output." 😌

$> mysql_config
Usage: ./mysql_config [OPTIONS]
Compiler: GNU 10.4.0
Options:
  --cflags         [-I/usr/local/mysql/include/mysql]
  --cxxflags       [-I/usr/local/mysql/include/mysql]
  --include        [-I/usr/local/mysql/include/mysql]
  --libs           [-L/usr/local/mysql/lib/mysql -lmysqlclient -lpthread -ldl
                    -lssl  -lcrypto -lresolv -lm -lrt]
  --libs_r         [-L/usr/local/mysql/lib/mysql -lmysqlclient -lpthread -ldl
                    -lssl  -lcrypto -lresolv -lm -lrt]
  --plugindir      [/usr/local/mysql/lib/plugin]
  --socket         [/tmp/mysql.sock]
  --port           [3306]
  --version        [8.4.0]
  --variable=VAR   VAR is one of:
          pkgincludedir [/usr/local/mysql/include]
          pkglibdir     [/usr/local/mysql/lib]
          plugindir     [/usr/local/mysql/lib/plugin]

πŸŽ€ backticks are the moment

You can use mysql_config inside a command line using backticks, so the output it produces for particular options gets dropped right on in. Iconic behavior honestly. πŸ”₯

For example, to compile and link a MySQL client program, use mysql_config as follows:

gcc -c `mysql_config --cflags` progname.c
gcc -o progname progname.o `mysql_config --libs`

Look at her go. Ate and left no crumbs. πŸ‘‘


Copyright Β© 1997, 2026, Oracle and/or its affiliates.

This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. (Yes, this part is in all caps in the original too β€” it's serious business, don't come for me. 😭)

You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.


⭐ NOTES ⭐

  1. Building C API Client Programs Using pkg-config β€” https://dev.mysql.com/doc/c-api/9.7/en/c-api-building-clients-pkg-config.html

That's the link from the note up top, in case you were wondering. I gotchu. 🫢


πŸ¦„ SEE ALSO πŸ¦„

For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online at http://dev.mysql.com/doc/. Go read it, she's giving main character energy. πŸ“š


🌸 AUTHOR 🌸

Oracle Corporation (http://dev.mysql.com/).


Okay bye bestie, that's the whole page β€” and fr fr, this was MySQL 9.7 dated 06/25/2026, page MYSQL_CONFIG(1). Slay, go compile something. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from