![background image](http://html1.mh-extra.com/html/oracle/5-0/5-0_reference-manual_16461962846.webp)
Debugging a MySQL Server
2826
This prints out where
mysqld
died. If that does not help you find out why
mysqld
died, you should
create a bug report and include the output from the preceding command with the bug report.
However, in most cases it does not help us to have just a stack trace to find the reason for the
problem. To be able to locate the bug or provide a workaround, in most cases we need to know the
statement that killed
mysqld
and preferably a test case so that we can repeat the problem! See
Section 1.7, “How to Report Bugs or Problems”
.
21.3.1.6. Using Server Logs to Find Causes of Errors in
mysqld
Note that before starting
mysqld
with the general query log enabled, you should check all your tables
with
myisamchk
. See
Chapter 5, MySQL Server Administration
.
If
mysqld
dies or hangs, you should start
mysqld
with the general query log enabled. See
Section 5.2.2, “The General Query Log”
. When
mysqld
dies again, you can examine the end of the log
file for the query that killed
mysqld
.
If you use the default general query log file, the log is stored in the database directory as
host_name.log
In most cases it is the last query in the log file that killed
mysqld
, but if possible you
should verify this by restarting
mysqld
and executing the found query from the
mysql
command-line
tools. If this works, you should also test all complicated queries that didn't complete.
You can also try the command
EXPLAIN
on all
SELECT
statements that takes a long time to ensure
that
mysqld
is using indexes properly. See
Section 13.8.2, “
EXPLAIN
Syntax”
.
You can find the queries that take a long time to execute by starting
mysqld
with the slow query log
enabled. See
Section 5.2.4, “The Slow Query Log”
.
If you find the text
mysqld restarted
in the error log file (normally named
hostname.err
) you
probably have found a query that causes
mysqld
to fail. If this happens, you should check all your
tables with
myisamchk
(see
Chapter 5, MySQL Server Administration
), and test the queries in the
MySQL log files to see whether one fails. 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 a MySQL mailing list. The mailing lists are described at
http://lists.mysql.com/
, which
also has links to online list archives.
If you have started
mysqld
with
--myisam-recover
[415]
, MySQL automatically checks and tries to
repair
MyISAM
tables if they are marked as 'not closed properly' or 'crashed'. If this happens, MySQL
writes an entry in the
hostname.err
file
'Warning: Checking table ...'
which is followed
by
Warning: Repairing table
if the table needs to be repaired. If you get a lot of these errors,
without
mysqld
having died unexpectedly just before, then something is wrong and needs to be
investigated further. See
Section 5.1.3, “Server Command Options”
.
It is not a good sign if
mysqld
did die unexpectedly, but in this case, you should not investigate the
Checking table...
messages, but instead try to find out why
mysqld
died.
21.3.1.7. Making a Test Case If You Experience Table Corruption
If you get corrupted tables or if
mysqld
always fails after some update commands, you can test
whether this bug is reproducible by doing the following:
• Take down the MySQL daemon (with
mysqladmin shutdown
).
• Make a backup of the tables (to guard against the very unlikely case that the repair does something
bad).
• Check all tables with
myisamchk -s database/*.MYI
. Repair any wrong tables with
myisamchk
-r database/table.MYI
.
• Make a second backup of the tables.
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...