1
2
.\" Title: \fBmysqlcheck\fR
3
.\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/>
3
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
4
.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
5
6
.\" Manual: MySQL Database System
6
7
.\" Source: MySQL 5.1
8
.TH "\fBMYSQLCHECK\fR" "1" "03/31/2009" "MySQL 5.1" "MySQL Database System"
10
.TH "\FBMYSQLCHECK\FR" "1" "07/13/2009" "MySQL 5\&.1" "MySQL Database System"
11
.\" -----------------------------------------------------------------
12
.\" * set default formatting
13
.\" -----------------------------------------------------------------
9
14
.\" disable hyphenation
11
16
.\" disable justification (adjust text to left margin only)
18
.\" -----------------------------------------------------------------
19
.\" * MAIN CONTENT STARTS HERE *
20
.\" -----------------------------------------------------------------
22
.\" maintenance: tables
24
.\" tables: maintenance
14
mysqlcheck \- a table maintenance and repair program
27
mysqlcheck \- a table maintenance program
17
\fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB ...]]\fR
29
.HP \w'\fBmysqlcheck\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.]]\fR\ 'u
30
\fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]]\fR
22
client checks, repairs, optimizes, and analyzes tables.
35
client performs table maintenance: It checks, repairs, optimizes, or analyzes tables\&.
37
Each table is locked and therefore unavailable to other sessions while it is being processed\&. Table maintenance operations can be time\-consuming, particularly for large tables\&. If you use the
40
\fB\-\-all\-databases\fR
41
option to process all tables in one or more databases, an invocation of
43
might take a long time\&. (This is also true for
45
because that program invokes
47
to check all tables and repair them if necessary\&.)
25
50
is similar in function to
26
\fBmyisamchk\fR, but works differently. The main operational difference is that
51
\fBmyisamchk\fR, but works differently\&. The main operational difference is that
28
53
must be used when the
30
55
server is running, whereas
32
should be used when it is not. The benefit of using
57
should be used when it is not\&. The benefit of using
34
is that you do not have to stop the server to check or repair your tables.
59
is that you do not have to stop the server to perform table maintenance\&.
37
62
uses the SQL statements
42
in a convenient way for the user. It determines which statements to use for the operation you want to perform, and then sends the statements to the server to be executed. For details about which storage engines each statement works with, see the descriptions for those statements in
43
Chapter\ 12, SQL Statement Syntax.
67
in a convenient way for the user\&. It determines which statements to use for the operation you want to perform, and then sends the statements to the server to be executed\&. For details about which storage engines each statement works with, see the descriptions for those statements in
68
Section\ \&12.5.2, \(lqTable Maintenance Statements\(rq\&.
47
storage engine supports all four statements, so
72
storage engine supports all four maintenance operations, so
49
can be used to perform all four operations on
74
can be used to perform any of them on
51
tables. Other storage engines do not necessarily support all operations. In such cases, an error message is displayed. For example, if
76
tables\&. Other storage engines do not necessarily support all operations\&. In such cases, an error message is displayed\&. For example, if
55
80
table, an attempt to check it produces this result:
59
86
shell> \fBmysqlcheck test t\fR
61
note : The storage engine for the table doesn't support check
88
note : The storage engine for the table doesn\'t support check
96
is unable to repair a table, see
97
Section\ \&2.12.4, \(lqRebuilding or Repairing Tables or Indexes\(rq
98
for manual table repair strategies\&. This will be the case, for example, for
100
tables, which can be checked with
101
CHECK TABLE, but not repaired with
67
with partitioned tables is not supported before MySQL 5.1.27.
106
with partitioned tables is not supported before MySQL 5\&.1\&.27\&.
70
112
.nr an-no-space-flag 1
71
113
.nr an-break-flag 1
75
It is best to make a backup of a table before performing a table repair operation; under some circumstances the operation might cause data loss. Possible causes include but are not limited to file system errors.
120
It is best to make a backup of a table before performing a table repair operation; under some circumstances the operation might cause data loss\&. Possible causes include but are not limited to file system errors\&.
77
124
There are three general ways to invoke
82
131
shell> \fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItables\fR\fR\fB]\fR
83
shell> \fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name1\fR\fR\fB [\fR\fB\fIdb_name2\fR\fR\fB \fR\fB\fIdb_name3\fR\fR\fB...]\fR
132
shell> \fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name1\fR\fR\fB [\fR\fB\fIdb_name2\fR\fR\fB \fR\fB\fIdb_name3\fR\fR\fB\&.\&.\&.]\fR
84
133
shell> \fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] \-\-all\-databases\fR
88
139
If you do not name any tables following
127
178
The default option is \fB\-\-optimize\fR
133
supports the following options:
184
supports the options in the following list\&. It also reads option files and supports the options for processing them described at
185
Section\ \&4.2.3.3.1, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&.
195
.\" mysqlcheck: help option
196
.\" help option: mysqlcheck
139
Display a help message and exit.
200
Display a help message and exit\&.
211
.\" mysqlcheck: all-databases option
212
.\" all-databases option: mysqlcheck
142
213
\fB\-\-all\-databases\fR,
145
Check all tables in all databases. This is the same as using the
216
Check all tables in all databases\&. This is the same as using the
146
217
\fB\-\-databases\fR
147
option and naming all the databases on the command line.
218
option and naming all the databases on the command line\&.
229
.\" mysqlcheck: all-in-1 option
230
.\" all-in-1 option: mysqlcheck
150
231
\fB\-\-all\-in\-1\fR,
153
Instead of issuing a statement for each table, execute a single statement for each database that names all the tables from that database to be processed.
234
Instead of issuing a statement for each table, execute a single statement for each database that names all the tables from that database to be processed\&.
245
.\" mysqlcheck: analyze option
246
.\" analyze option: mysqlcheck
156
247
\fB\-\-analyze\fR,
250
Analyze the tables\&.
261
.\" mysqlcheck: auto-repair option
262
.\" auto-repair option: mysqlcheck
162
263
\fB\-\-auto\-repair\fR
164
If a checked table is corrupted, automatically fix it. Any necessary repairs are done after all tables have been checked.
265
If a checked table is corrupted, automatically fix it\&. Any necessary repairs are done after all tables have been checked\&.
276
.\" mysqlcheck: character-sets-dir option
277
.\" character-sets-dir option: mysqlcheck
167
278
\fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR
169
The directory where character sets are installed. See
170
Section\ 9.2, \(lqThe Character Set Used for Data and Sorting\(rq.
280
The directory where character sets are installed\&. See
281
Section\ \&9.2, \(lqThe Character Set Used for Data and Sorting\(rq\&.
292
.\" mysqlcheck: check option
293
.\" check option: mysqlcheck
176
Check the tables for errors. This is the default operation.
297
Check the tables for errors\&. This is the default operation\&.
308
.\" mysqlcheck: check-only-changed option
309
.\" check-only-changed option: mysqlcheck
179
310
\fB\-\-check\-only\-changed\fR,
182
Check only tables that have changed since the last check or that have not been closed properly.
313
Check only tables that have changed since the last check or that have not been closed properly\&.
324
.\" mysqlcheck: check-upgrade option
325
.\" check-upgrade option: mysqlcheck
185
326
\fB\-\-check\-upgrade\fR,
192
option to check tables for incompatibilities with the current version of the server. This option automatically enables the
333
option to check tables for incompatibilities with the current version of the server\&. This option automatically enables the
193
334
\fB\-\-fix\-db\-names\fR
195
336
\fB\-\-fix\-table\-names\fR
197
338
\fB\-\-check\-upgrade\fR
198
was added in MySQL 5.1.7.
339
was added in MySQL 5\&.1\&.7\&.
350
.\" mysqlcheck: compress option
351
.\" compress option: mysqlcheck
201
352
\fB\-\-compress\fR
203
Compress all information sent between the client and the server if both support compression.
354
Compress all information sent between the client and the server if both support compression\&.
365
.\" mysqlcheck: databases option
366
.\" databases option: mysqlcheck
206
367
\fB\-\-databases\fR,
209
Process all tables in the named databases. Normally,
370
Process all tables in the named databases\&. Normally,
211
treats the first name argument on the command line as a database name and following names as table names. With this option, it treats all name arguments as database names.
372
treats the first name argument on the command line as a database name and following names as table names\&. With this option, it treats all name arguments as database names\&.
383
.\" mysqlcheck: debug option
384
.\" debug option: mysqlcheck
214
385
\fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR,
215
386
\fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR
217
Write a debugging log. A typical
388
Write a debugging log\&. A typical
218
389
\fIdebug_options\fR
220
\'d:t:o,\fIfile_name\fR'.
391
\'d:t:o,\fIfile_name\fR\'\&. The default is
403
.\" mysqlcheck: debug-check option
404
.\" debug-check option: mysqlcheck
223
405
\fB\-\-debug\-check\fR
225
Print some debugging information when the program exits. This option was added in MySQL 5.1.21.
407
Print some debugging information when the program exits\&. This option was added in MySQL 5\&.1\&.21\&.
418
.\" mysqlcheck: debug-info option
419
.\" debug-info option: mysqlcheck
228
420
\fB\-\-debug\-info\fR
230
Print debugging information and memory and CPU usage statistics when the program exits. This option was added in MySQL 5.1.14.
422
Print debugging information and memory and CPU usage statistics when the program exits\&. This option was added in MySQL 5\&.1\&.14\&.
433
.\" mysqlcheck: default-character-set option
434
.\" default-character-set option: mysqlcheck
233
435
\fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR
236
438
\fIcharset_name\fR
237
as the default character set. See
238
Section\ 9.2, \(lqThe Character Set Used for Data and Sorting\(rq.
439
as the default character set\&. See
440
Section\ \&9.2, \(lqThe Character Set Used for Data and Sorting\(rq\&.
451
.\" mysqlcheck: extended option
452
.\" extended option: mysqlcheck
241
453
\fB\-\-extended\fR,
244
If you are using this option to check tables, it ensures that they are 100% consistent but takes a long time.
456
If you are using this option to check tables, it ensures that they are 100% consistent but takes a long time\&.
246
458
If you are using this option to repair tables, it runs an extended repair that may not only take a long time to execute, but may produce a lot of garbage rows also!
469
.\" mysqlcheck: fast option
470
.\" fast option: mysqlcheck
252
Check only tables that have not been closed properly.
474
Check only tables that have not been closed properly\&.
485
.\" mysqlcheck: fix-db-names option
486
.\" fix-db-names option: mysqlcheck
255
487
\fB\-\-fix\-db\-names\fR
257
Convert database names to 5.1 format. Only database names that contain special characters are affected. This option was added in MySQL 5.1.7.
489
Convert database names to 5\&.1 format\&. Only database names that contain special characters are affected\&. This option was added in MySQL 5\&.1\&.7\&.
500
.\" mysqlcheck: fix-table-names option
501
.\" fix-table-names option: mysqlcheck
260
502
\fB\-\-fix\-table\-names\fR
262
Convert table names to 5.1 format. Only table names that contain special characters are affected. This option was added in MySQL 5.1.7. As of MySQL 5.1.23, this option also applies to views.
504
Convert table names to 5\&.1 format\&. Only table names that contain special characters are affected\&. This option was added in MySQL 5\&.1\&.7\&. As of MySQL 5\&.1\&.23, this option also applies to views\&.
515
.\" mysqlcheck: force option
516
.\" force option: mysqlcheck
268
Continue even if an SQL error occurs.
520
Continue even if an SQL error occurs\&.
531
.\" mysqlcheck: host option
532
.\" host option: mysqlcheck
271
533
\fB\-\-host=\fR\fB\fIhost_name\fR\fR,
272
534
\fB\-h \fR\fB\fIhost_name\fR\fR
274
Connect to the MySQL server on the given host.
536
Connect to the MySQL server on the given host\&.
547
.\" mysqlcheck: medium-check option
548
.\" medium-check option: mysqlcheck
277
549
\fB\-\-medium\-check\fR,
280
552
Do a check that is faster than an
281
553
\fB\-\-extended\fR
282
operation. This finds only 99.99% of all errors, which should be good enough in most cases.
554
operation\&. This finds only 99\&.99% of all errors, which should be good enough in most cases\&.
565
.\" mysqlcheck: optimize option
566
.\" optimize option: mysqlcheck
285
567
\fB\-\-optimize\fR,
570
Optimize the tables\&.
581
.\" mysqlcheck: password option
582
.\" password option: mysqlcheck
291
583
\fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR,
292
584
\fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR
294
The password to use when connecting to the server. If you use the short option form (\fB\-p\fR), you
586
The password to use when connecting to the server\&. If you use the short option form (\fB\-p\fR), you
296
have a space between the option and the password. If you omit the
588
have a space between the option and the password\&. If you omit the
298
590
value following the
299
591
\fB\-\-password\fR
302
option on the command line, you are prompted for one.
304
Specifying a password on the command line should be considered insecure. See
305
Section\ 5.5.6.2, \(lqEnd\-User Guidelines for Password Security\(rq.
594
option on the command line, you are prompted for one\&.
596
Specifying a password on the command line should be considered insecure\&. See
597
Section\ \&5.5.6.2, \(lqEnd-User Guidelines for Password Security\(rq\&.
608
.\" mysqlcheck: pipe option
609
.\" pipe option: mysql
311
On Windows, connect to the server via a named pipe. This option applies only for connections to a local server, and only if the server supports named\-pipe connections.
613
On Windows, connect to the server via a named pipe\&. This option applies only for connections to a local server, and only if the server supports named\-pipe connections\&.
624
.\" mysqlcheck: port option
625
.\" port option: mysqlcheck
314
626
\fB\-\-port=\fR\fB\fIport_num\fR\fR,
315
627
\fB\-P \fR\fB\fIport_num\fR\fR
317
The TCP/IP port number to use for the connection.
629
The TCP/IP port number to use for the connection\&.
640
.\" mysqlcheck: protocol option
641
.\" protocol option: mysqlcheck
320
642
\fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR
322
The connection protocol to use for connecting to the server. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want. For details on the allowable values, see
323
Section\ 4.2.2, \(lqConnecting to the MySQL Server\(rq.
644
The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. For details on the allowable values, see
645
Section\ \&4.2.2, \(lqConnecting to the MySQL Server\(rq\&.
656
.\" mysqlcheck: quick option
657
.\" quick option: mysqlcheck
329
If you are using this option to check tables, it prevents the check from scanning the rows to check for incorrect links. This is the fastest check method.
331
If you are using this option to repair tables, it tries to repair only the index tree. This is the fastest repair method.
661
If you are using this option to check tables, it prevents the check from scanning the rows to check for incorrect links\&. This is the fastest check method\&.
663
If you are using this option to repair tables, it tries to repair only the index tree\&. This is the fastest repair method\&.
674
.\" mysqlcheck: repair option
675
.\" repair option: mysqlcheck
334
676
\fB\-\-repair\fR,
337
Perform a repair that can fix almost anything except unique keys that are not unique.
679
Perform a repair that can fix almost anything except unique keys that are not unique\&.
690
.\" mysqlcheck: silent option
691
.\" silent option: mysqlcheck
340
692
\fB\-\-silent\fR,
343
Silent mode. Print only error messages.
695
Silent mode\&. Print only error messages\&.
706
.\" mysqlcheck: socket option
707
.\" socket option: mysqlcheck
346
708
\fB\-\-socket=\fR\fB\fIpath\fR\fR,
347
709
\fB\-S \fR\fB\fIpath\fR\fR
349
711
For connections to
350
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use.
712
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&.
723
.\" mysqlcheck: SSL options
724
.\" SSL options: mysqlcheck
355
727
Options that begin with
357
specify whether to connect to the server via SSL and indicate where to find SSL keys and certificates. See
358
Section\ 5.5.7.3, \(lqSSL Command Options\(rq.
729
specify whether to connect to the server via SSL and indicate where to find SSL keys and certificates\&. See
730
Section\ \&5.5.7.3, \(lqSSL Command Options\(rq\&.
741
.\" mysqlcheck: tables option
742
.\" tables option: mysqlcheck
364
746
\fB\-\-databases\fR
367
option. All name arguments following the option are regarded as table names.
749
option\&. All name arguments following the option are regarded as table names\&.
760
.\" mysqlcheck: use-frm option
761
.\" use-frm option: mysqlcheck
370
762
\fB\-\-use\-frm\fR
372
764
For repair operations on
374
766
tables, get the table structure from the
376
768
file so that the table can be repaired even if the
770
header is corrupted\&.
781
.\" mysqlcheck: user option
782
.\" user option: mysqlcheck
381
783
\fB\-\-user=\fR\fB\fIuser_name\fR\fR,
382
784
\fB\-u \fR\fB\fIuser_name\fR\fR
384
The MySQL user name to use when connecting to the server.
786
The MySQL user name to use when connecting to the server\&.
797
.\" mysqlcheck: verbose option
798
.\" verbose option: mysqlcheck
387
799
\fB\-\-verbose\fR,
390
Verbose mode. Print information about the various stages of program operation.
802
Verbose mode\&. Print information about the various stages of program operation\&.
813
.\" mysqlcheck: version option
814
.\" version option: mysqlcheck
393
815
\fB\-\-version\fR,
396
Display version information and exit.
818
Display version information and exit\&.
399
Copyright 2007\-2008 MySQL AB, 2009 Sun Microsystems, Inc.
823
Copyright 2007-2008 MySQL AB, 2009 Sun Microsystems, Inc.
401
825
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
403
827
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
405
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110\-1301 USA or see http://www.gnu.org/licenses/.
829
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
407
832
For more information, please refer to the MySQL Reference Manual,
408
833
which may already be installed locally and which is also available
409
834
online at http://dev.mysql.com/doc/.
411
MySQL AB (http://www.mysql.com/).
836
Sun Microsystems, Inc. (http://www.mysql.com/).