If you have some very specific problem, you can always try to
debug MySQL. To do this you must configure MySQL with the
--with-debug
or the
--with-debug=full
option. You can check
whether MySQL was 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.
If you are using gcc or egcs, the recommended configure line is:
CC=gcc CFLAGS="-O2" CXX=gcc CXXFLAGS="-O2 -felide-constructors \ -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql \ --with-debug --with-extra-charsets=complex
This avoids problems with the libstdc++
library and with C++ exceptions (many compilers have problems
with C++ exceptions in threaded code) and compile a MySQL
version with support for all character sets.
If you suspect a memory overrun error, you can configure MySQL
with --with-debug=full
, which installs a
memory allocation (SAFEMALLOC
) checker.
However, running with SAFEMALLOC
is quite
slow, so if you get performance problems you should start
mysqld with the
--skip-safemalloc
option. This disables the
memory overrun checks for each call to
malloc()
and free()
.
If mysqld stops crashing when you compile it
with --with-debug
, you probably have found a
compiler bug or a timing bug within MySQL. In this case, you can
try to add -g
to the
CFLAGS
and CXXFLAGS
variables above and not use --with-debug
. If
mysqld dies, you can at least attach to it
with gdb or use gdb on the
core file to find out what happened.
When you configure MySQL for debugging you automatically enable
a lot of extra safety check functions that monitor the health of
mysqld. If they find something
“unexpected,” an entry is written to
stderr
, which safe_mysqld
directs to the error log! This also means that if you are having
some unexpected problems with MySQL and are using a source
distribution, the first thing you should do is to configure
MySQL for debugging! (The second thing is to send mail to a
MySQL mailing list and ask for help. See
Sección 1.6.1.1, “Las listas de correo de MySQL”. Please use the
mysqlbug script for all bug reports or
questions regarding the MySQL version you are using!
In the Windows MySQL distribution, mysqld.exe
is by default compiled with support for trace files.
Ésta es una traducción del manual de referencia de MySQL, que puede encontrarse en dev.mysql.com. El manual de referencia original de MySQL está escrito en inglés, y esta traducción no necesariamente está tan actualizada como la versión original. Para cualquier sugerencia sobre la traducción y para señalar errores de cualquier tipo, no dude en dirigirse a mysql-es@vespito.com.