Creating a Trace File
mysqld is crashing, creating a trace file is a good way to find the issue.
mysqld binary that has been compiled with debugging support can create trace files using the DBUG package created by Fred Fish. To find out if your
mysqld binary has debugging support, run
mysqld -V on the command line. If the version number ends in
-debug then your
mysqld binary was compiled with debugging support.
See Compiling MariaDB for debugging for instructions on how to create your own
mysqld binary with debugging enabled.
To create the trace log, start
mysqld like so:
Without options for --debug, the trace file will be named
/tmp/mysqld.trace in MySQL and older versions of MariaDB before 10.5 and
/tmp/mariadbd.trace starting from MariaDB 10.5.
On Windows, the debug
mysqld is called
mysqld-debug and you should also use the
--standalone option. So the command on Windows will look like:
mysqld-debug --debug --standalone
Once the server is started, use the regular
mysql command-line client (or another client) to connect and work with the server.
After you are finished debugging, stop the server with:
Trace files can grow to a significant size. You can reduce their size by telling the server to only log certain items.
--debug flag can take extra options in the form of a colon (:) delimited string of options. Individual options can have comma-separated sub-options.
d' option limits the output to the named DBUG_<N> macros. In the above example, the
/tmp/mariadbd.trace tracefile will contain output from the info, error, and query DBUG macros. A '
d' by itself (with no sub-options) will select all DBUG_<N> macros.
o' option redirects the output to a file (
/tmp/mariadbd.trace in the example above) and overwrites the file if it exists.