Menu:
resolve-stack-dump:: resolve_stack_dump -- Resolve Numeric Stack Trace Dump to Symbols
This section describes some utilities that you may find useful when developing MySQL programs.
In shell scripts, you can use the note 'my_print_defaults': my-print-defaults. program to parse option files and see what options would be used by a given program. The following example shows the output that note 'my_print_defaults': my-print-defaults. might produce when asked to show the options found in the '[client]' and '[mysql]' groups:
$> 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. 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 does not read option files, you need add only two lines to give it that capability. Check the source code of any of the standard MySQL clients to see how to do this.
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.
File: manual.info.tmp, Node: mysql-config, Next: my-print-defaults, Prev: programs-development, Up: programs-development
*note 'mysql_config': 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.
Note:
As of MySQL 5.7.9, 'pkg-config' can be used as an alternative to *note 'mysql_config': mysql-config. for obtaining information such as compiler flags or link libraries required to compile MySQL applications. For more information, see Building C API Client Programs Using pkg-config (https://dev.mysql.com/doc/c-api/5.7/en/c-api-building-clients-pkg-config.html).
Note:
As of MySQL 5.7.4, for binary distributions for Solaris, *note 'mysql_config': mysql-config. does not provide arguments for linking with the embedded library. To get linking arguments for the embedded library, use the 'mysql_server_config' script instead.
*note 'mysql_config': mysql-config. supports the following options.
'--cflags'
C Compiler flags to find include files and critical compiler flags and defines used when compiling the '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. Use '--include' for more portable options that contain only include paths.
'--cxxflags'
Like '--cflags', but for C++ compiler flags.
'--include'
Compiler options to find MySQL include files.
'--libmysqld-libs', '--embedded-libs', '--embedded'
Libraries and options required to link with 'libmysqld', the MySQL embedded server.
Note:
The 'libmysqld' embedded server library is deprecated as of MySQL 5.7.19 and has been removed in MySQL 8.0.
'--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. In MySQL 5.7, all client libraries are thread-safe, so this option need not be used. The '--libs' option can be used in all cases.
'--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. Permitted VAR_NAME values are 'pkgincludedir' (the header file directory), 'pkglibdir' (the library directory), and 'plugindir' (the plugin directory).
'--version'
Version number for the MySQL distribution.
If you invoke *note 'mysql_config': mysql-config. with no options, it displays a list of all options that it supports, and their values:
$> 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.7.9]
--libmysqld-libs [-L/usr/local/mysql/lib/mysql -lmysqld
-lpthread -lm -lrt -lssl -lcrypto -ldl -lcrypt]
--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 note 'mysql_config': mysql-config. within a command line using backticks to include the output that it produces for particular options. For example, to compile and link a MySQL client program, use note 'mysql_config': mysql-config. as follows:
gcc -c `mysql_config --cflags` progname.c
gcc -o progname progname.o `mysql_config --libs`
File: manual.info.tmp, Node: my-print-defaults, Next: resolve-stack-dump, Prev: mysql-config, Up: programs-development
note 'my_print_defaults': my-print-defaults. displays the options that are present in option groups of option files. The output indicates what options are used by programs that read the specified option groups. For example, the note 'mysqlcheck': mysqlcheck. program reads the '[mysqlcheck]' and '[client]' option groups. To see what options are present in those groups in the standard option files, invoke *note 'my_print_defaults': my-print-defaults. like this:
$> my_print_defaults mysqlcheck client
--user=myusername
--password=PASSWORD
--host=localhost
The output consists of options, one per line, in the form that they would be specified on the command line.
*note 'my_print_defaults': my-print-defaults. supports the following options.
'--help', '-?'
Display a help message and exit.
'--config-file=FILE_NAME', '--defaults-file=FILE_NAME', '-c FILE_NAME'
Read only the given option file.
'--debug=DEBUG_OPTIONS', '-# DEBUG_OPTIONS'
Write a debugging log. A typical DEBUG_OPTIONS string is 'd:t:o,FILE_NAME'. The default is 'd:t:o,/tmp/my_print_defaults.trace'.
'--defaults-extra-file=FILE_NAME', '--extra-file=FILE_NAME', '-e FILE_NAME'
Read this option file after the global option file but (on Unix) before the user option file.
For additional information about this and other option-file options, see *note option-file-options::.
'--defaults-group-suffix=SUFFIX', '-g SUFFIX'
In addition to the groups named on the command line, read groups that have the given suffix.
For additional information about this and other option-file options, see *note option-file-options::.
'--login-path=NAME', '-l NAME'
Read options from the named login path in the '.mylogin.cnf' login path file. A 'login path' is an option group containing options that specify which MySQL server to connect to and which account to authenticate as. To create or modify a login path file, use the note 'mysql_config_editor': mysql-config-editor. utility. See note mysql-config-editor::.
For additional information about this and other option-file options, see *note option-file-options::.
'--no-defaults', '-n'
Return an empty string.
For additional information about this and other option-file options, see *note option-file-options::.
'--show', '-s'
As of MySQL 5.7.8, *note 'my_print_defaults': my-print-defaults. masks passwords by default. Use this option to display passwords in cleartext.
'--verbose', '-v'
Verbose mode. Print more information about what the program does.
'--version', '-V'
Display version information and exit.
File: manual.info.tmp, Node: resolve-stack-dump, Prev: my-print-defaults, Up: programs-development
*note 'resolve_stack_dump': resolve-stack-dump. resolves a numeric stack dump to symbols.
Note:
note 'resolve_stack_dump': resolve-stack-dump. is deprecated and is removed in MySQL 8.0. Stack traces from official MySQL builds are always symbolized, so there is no need to use note 'resolve_stack_dump': resolve-stack-dump.
Invoke *note 'resolve_stack_dump': resolve-stack-dump. like this:
resolve_stack_dump [OPTIONS] SYMBOLS_FILE [NUMERIC_DUMP_FILE]
The symbols file should include the output from the 'nm --numeric-sort mysqld' command. The numeric dump file should contain a numeric stack track from *note 'mysqld': mysqld. If no numeric dump file is named on the command line, the stack trace is read from the standard input.
*note 'resolve_stack_dump': resolve-stack-dump. supports the following options.
'--help', '-h'
Display a help message and exit.
'--numeric-dump-file=FILE_NAME', '-n FILE_NAME'
Read the stack trace from the given file.
'--symbols-file=FILE_NAME', '-s FILE_NAME'
Use the given symbols file.
'--version', '-V'
Display version information and exit.
For more information, see *note using-stack-trace::.
File: manual.info.tmp, Node: programs-miscellaneous, Next: environment-variables, Prev: programs-development, Up: programs