Go to the first, previous, next, last section, table of contents.


Debugging MySQL

If you have some very specific problem, you can always try to debug MySQL. To do this you must configure MySQL with the option --with-debug=yes. You can check if MySQL if compiled with debugging by doing: mysqld --help. If the --debug flag is listed with the options then you have debugging enabled. mysqladmin ver also lists the mysqld version as mysql ... -debug in this case.

Start the mysql server with a trace log in /tmp/mysql.trace. The log file will get very BIG.

mysqld --debug

or you can start it with

mysqld --debug=d,info,error,query,general,where:O,/tmp/mysql.trace

which only prints information with the most interesting tags.

When you configure MySQL for debugging you automaticly enable a lot of extra safety check functions that monitors the health of mysqld. If they find something 'unexpected' a entry will be written to stderr, which safe_mysqld directs to the error log! This also means that if you are having some unexpected problems with MySQL, the first thing you, if you are using a source distribution, is to configure MySQL for debugging! (The second thing is of course to mail to mysql@tcx.se and ask for help. Please use the mysqlbug script for all bug reports or questions regarding a MySQL version you are using!

On most system (except Linux) you can also start mysqld in gdb to get more information if mysqld crashes.

shell> gdb libexec/mysqld
gdb>   run
...
back   # Do this when mysqld crashes
quit


Go to the first, previous, next, last section, table of contents.