4.7 Program Development Utilities程序开发实用程序

4.7.1 mysql_config — Display Options for Compiling Clients编译客户端的显示选项
4.7.2 my_print_defaults — Display Options from Option Files显示选项文件中的选项

This section describes some utilities that you may find useful when developing MySQL programs.本节介绍一些在开发MySQL程序时可能很有用的实用程序。

In shell scripts, you can use the my_print_defaults program to parse option files and see what options would be used by a given program. 在shell脚本中,您可以使用my_print_defaults程序来解析选项文件,并查看给定程序将使用哪些选项。The following example shows the output that my_print_defaults might produce when asked to show the options found in the [client] and [mysql] groups:以下示例显示了my_print_defaults在被要求显示[client][mysql]组中的选项时可能产生的输出:

shell> my_print_defaults client mysql
--port=3306
--socket=/tmp/mysql.sock
--no-auto-rehash

Note for developers: Option file handling is implemented in the C client library simply by processing all options in the appropriate group or groups before any command-line arguments. 开发人员注意:选项文件处理是在C客户端库中实现的,只需在任何命令行参数之前处理相应组中的所有选项即可。This works well for programs that use the last instance of an option that is specified multiple times. 这对于使用多次指定的选项的最后一个实例的程序来说效果很好。If you have a C or C++ program that handles multiply specified options this way but that doesn't read option files, you need add only two lines to give it that capability. 如果你有一个C或C++程序,它以这种方式处理多个指定的选项,但不读取选项文件,你只需要添加两行来赋予它这种能力。Check the source code of any of the standard MySQL clients to see how to do this.检查任何标准MySQL客户端的源代码,看看如何做到这一点。

Several other language interfaces to MySQL are based on the C client library, and some of them provide a way to access option file contents. These include Perl and Python. For details, see the documentation for your preferred interface.MySQL的其他几个语言接口基于C客户端库,其中一些提供了一种访问选项文件内容的方法。其中包括Perl和Python。有关详细信息,请参阅首选界面的文档。

4.7.1 mysql_config — Display Options for Compiling Clients
4.7.2 my_print_defaults — Display Options from Option Files