MYSQL_CONFIG(1)
π 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-configcan be used as an alternative tomysql_configfor 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 thelibmysqlclientlibrary. 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--includeinstead.--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--libsoption 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 permittedvar_namevalues arepkgincludedir(the header file directory),pkglibdir(the library directory), andplugindir(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 π
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 β
- 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
- arch rolling: percona-server-clients 9.7.2_2-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms