If you are using some functionality that is very new in MySQL,
you can try to run mysqld with the
--skip-new (which will disable all
new, potentially unsafe functionality) or with
disables a lot of optimization that may cause problems.
18.1 Que faire si MySQL plante constamment?.
mysqld doesn't want to start, you should check that you don't have
my.cnf file that interferes with your setup!
You can check your
my.cnf arguments with
and avoid using them by starting with
mysqld --no-defaults ....
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. You can check whether or not
MySQL was compiled with debugging by doing:
--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="-O6" CXX=gcc CXXFLAGS="-O6 -felide-constructors -fno-exceptions
-fno-rtti" ./configure --prefix=/usr/local/mysql --with-debug
This will avoid problems with the libstdc++ library and with C++ exceptions.
If you can cause the
mysqld server to crash quickly, you can try to
create a trace file of this:
mysqld server with a trace log in `/tmp/mysql.trace'.
The log file will get very BIG.
mysqld --debug --log
or you can start it with
which only prints information with the most interesting tags.
When you configure MySQL for debugging you automatically enable a
lot of extra safety check functions that monitor the health of
If they find something ``unexpected,'' an entry will be written to
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, of course, is to
send mail to email@example.com and ask for help. Please use the
mysqlbug script for all bug reports or questions regarding the
MySQL version you are using!
On most system you can also start
gdb to get
more information if
gdb versions on Linux you must use
run --one-thread if
you want to be able to debug
mysqld threads. In this case you
can only have one thread active at a time.
If you are using gdb 4.17.x on Linux, you should install a `.gdb' file,
with the following information, in your current directory:
set print sevenbit off
handle SIGUSR1 nostop noprint
handle SIGUSR2 nostop noprint
handle SIGWAITING nostop noprint
handle SIGLWP nostop noprint
handle SIGPIPE nostop
handle SIGALRM nostop
handle SIGHUP nostop
handle SIGTERM nostop noprint
Here follows an example how to debug mysqld:
shell> gdb /usr/local/libexec/mysqld
back # Do this when mysqld crashes
(until you get some information about local variables)
Include the above output in a mail generated with
mail this to
mysqld hangs you can try to use some system tools like
/usr/proc/bin/pstack to examine where
mysqld has hanged.
mysqld starts to eat up CPU or memory or if it ``hangs'', you
mysqladmin processlist status to find out if someone is
executing some query that takes a long time. It may be a good idea to
mysqladmin -i10 processlist status in some window if you are
experiencing performance problems or problems when new clients can't connect.
mysqld dies or hangs, you should start
mysqld dies again, you can check in the log file
for the query that killed
mysqld. Note that before starting
--log you should check all your tables with
isamchk. 13 Maintenance d'un serveur MySQL.
If you are using a log file,
mysqld --log, you should check the
'hostname' log files, that you can find in the database directory, for
any requêtesthat could cause a problem. Try the command
SELECT statements that takes a long time to ensure that
mysqld are using indexes properly.
should also test complicated requêtesthat didn't complete within the
mysql command line tool.
If you find the text
mysqld restarted in the error log file (normally
named `hostname.err') you have probably found a query that causes
mysqld to fail. If this happens you should check all your tables with
isamchk ( 13 Maintenance d'un serveur MySQL), and test the requêtesin the
MySQL log files if someone doesn't work. If you find such a query,
try first upgrading to the newest MySQL version. If this doesn't
help and you can't find anything in the
mysql mail archive, you should
report the bug to firstname.lastname@example.org. Links to mail archives are
available at the online MySQL
If you get corrupted tables or if
mysqld always fails after some
update commands, you can test if this bug is reproducible by doing the
Stop the mysqld daemon (with
Check all tables with
isamchk -s database/*.ISM. Repair any
wrong tables with
isamchk -r database/table.ISM.
When you have got a crashed table, stop the
Restore the backup.
mysqld server without
Re-execute the commands with
mysql < update-log. The update log
is saved in the MySQL database directory with the name
If the tables are now again corrupted, you have found reproducible bug
ISAM code! ftp the tables + the update log to
ftp://www.mysql.com/pub/mysql/secret and we will fix this as soon as
mysqladmin debug will dump some information about
locks in use, used memory and query usage to the mysql log file. This
may help solve some problems. This command also provides some useful
information even if you haven't compiled MySQL for debugging!
If the problem is that some tables are getting slower and slower you
should try to repair the tables with
isamchk to optimize the
table layout. You should also check the slow requêteswith
13 Maintenance d'un serveur MySQL.
You should also read the OS-specific section in this manual for
problems that may be unique to your environment. 4.11 Quelques spécificités liées aux OS
If you are using the Perl
DBI interface, you can turn on
debugging information by using the
trace méthode or by
DBI_TRACE environment variable.