mysql_config provides you with useful information for compiling your MySQL client and connecting it to MySQL. It is a shell script, so it is available only on Unix and Unix-like systems.mysql_config为您提供了编译mysql客户端并将其连接到mysql的有用信息。它是一个shell脚本,因此仅在Unix和类Unix系统上可用。
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. pkg-config可以用作mysql_config的替代品,用于获取编译mysql应用程序所需的编译器标志或链接库等信息。For more information, see Building C API Client Programs Using pkg-config.有关更多信息,请参阅使用pkg-config构建C API客户端程序。
mysql_config supports the following options.
C Compiler flags to find include files and critical compiler flags and defines used when compiling the 要查找的C编译器标志包括编译libmysqlclient
library. The options returned are tied to the specific compiler that was used when the library was created and might clash with the settings for your own compiler. libmysqlclient
库时使用的文件和关键编译器标志和定义。返回的选项与创建库时使用的特定编译器相关联,可能与您自己的编译器设置冲突。Use 使用--include
for more portable options that contain only include paths.--include
可获得仅包含include路径的更多可移植选项。
Like 类似于--cflags
, but for C++ compiler flags.--cflags
,但用于C++编译器标志。
Compiler options to find MySQL include files.查找MySQL的编译器选项包括文件。
Libraries and options required to link with the MySQL client library.与MySQL客户端库链接所需的库和选项。
Libraries and options required to link with the thread-safe MySQL client library. 与线程安全MySQL客户端库链接所需的库和选项。In MySQL 8.0, all client libraries are thread-safe, so this option need not be used. 在MySQL 8.0中,所有客户端库都是线程安全的,因此不需要使用此选项。The --libs
option can be used in all cases.--libs
选项可以在所有情况下使用。
The default plugin directory path name, defined when configuring MySQL.配置MySQL时定义的默认插件目录路径名。
The default TCP/IP port number, defined when configuring MySQL.配置MySQL时定义的默认TCP/IP端口号。
The default Unix socket file, defined when configuring MySQL.配置MySQL时定义的默认Unix套接字文件。
Display the value of the named configuration variable. 显示命名配置变量的值。Permitted 允许的var_name
values are pkgincludedir
(the header file directory), pkglibdir
(the library directory), and plugindir
(the plugin directory).var_name
值是pkgincludedir
(头文件目录)、pkglibdir
(库目录)和plugindir
(插件目录)。
Version number for the MySQL distribution.MySQL发行版的版本号。
If you invoke mysql_config with no options, it displays a list of all options that it supports, and their values:如果你在没有选项的情况下调用mysql_config,它会显示它支持的所有选项及其值的列表:
shell> mysql_config
Usage: /usr/local/mysql/bin/mysql_config [options]
Options:
--cflags [-I/usr/local/mysql/include/mysql -mcpu=pentiumpro]
--cxxflags [-I/usr/local/mysql/include/mysql -mcpu=pentiumpro]
--include [-I/usr/local/mysql/include/mysql]
--libs [-L/usr/local/mysql/lib/mysql -lmysqlclient
-lpthread -lm -lrt -lssl -lcrypto -ldl]
--libs_r [-L/usr/local/mysql/lib/mysql -lmysqlclient_r
-lpthread -lm -lrt -lssl -lcrypto -ldl]
--plugindir [/usr/local/mysql/lib/plugin]
--socket [/tmp/mysql.sock]
--port [3306]
--version [5.8.0-m17]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/mysql/include]
pkglibdir [/usr/local/mysql/lib]
plugindir [/usr/local/mysql/lib/plugin]
You can use mysql_config within a command line using backticks to include the output that it produces for particular options. 您可以在命令行中使用mysql_config,使用回溯来包含它为特定选项生成的输出。For example, to compile and link a MySQL client program, use mysql_config as follows:例如,要编译和链接MySQL客户端程序,请按如下方式使用mysql_config
:
gcc -c `mysql_config --cflags` progname.c gcc -o progname progname.o `mysql_config --libs`