1MARIADB-CHECK(1)            MariaDB Database System           MARIADB-CHECK(1)
2
3
4

NAME

6       mariadb-check - a table maintenance program (mysqlcheck is now a
7       symlink to mariadb-check)
8

SYNOPSIS

10       mysqlcheck [options] [db_name [tbl_name ...]]
11

DESCRIPTION

13       The mysqlcheck client performs table maintenance: It checks, repairs,
14       optimizes, or analyzes tables.
15
16       Each table is locked and therefore unavailable to other sessions while
17       it is being processed, although for check operations, the table is
18       locked with a READ lock only. Table maintenance operations can be
19       time-consuming, particularly for large tables. If you use the
20       --databases or --all-databases option to process all tables in one or
21       more databases, an invocation of mysqlcheck might take a long time.
22       (This is also true for mysql_upgrade because that program invokes
23       mysqlcheck to check all tables and repair them if necessary.)
24
25       mysqlcheck is similar in function to myisamchk, but works differently.
26       The main operational difference is that mysqlcheck must be used when
27       the mysqld server is running, whereas myisamchk should be used when it
28       is not. The benefit of using mysqlcheck is that you do not have to stop
29       the server to perform table maintenance.
30
31       mysqlcheck uses the SQL statements CHECK TABLE, REPAIR TABLE, ANALYZE
32       TABLE, and OPTIMIZE TABLE in a convenient way for the user. It
33       determines which statements to use for the operation you want to
34       perform, and then sends the statements to the server to be executed.
35
36       The MyISAM storage engine supports all four maintenance operations, so
37       mysqlcheck can be used to perform any of them on MyISAM tables. Other
38       storage engines do not necessarily support all operations. In such
39       cases, an error message is displayed. For example, if test.t is a
40       MEMORY table, an attempt to check it produces this result:
41
42           shell> mysqlcheck test t
43           test.t
44           note     : The storage engine for the table doesn´t support check
45
46       If mysqlcheck is unable to repair a table, see the MariaDB Knowledge
47       Base for manual table repair strategies. This will be the case, for
48       example, for InnoDB tables, which can be checked with CHECK TABLE, but
49       not repaired with REPAIR TABLE.
50
51       The use of mysqlcheck with partitioned tables is not supported.
52
53           Caution
54           It is best to make a backup of a table before performing a table
55           repair operation; under some circumstances the operation might
56           cause data loss. Possible causes include but are not limited to
57           file system errors.
58
59       There are three general ways to invoke mysqlcheck:
60
61           shell> mysqlcheck [options] db_name [tbl_name ...]
62           shell> mysqlcheck [options] --databases db_name ...
63           shell> mysqlcheck [options] --all-databases
64
65       If you do not name any tables following db_name or if you use the
66       --databases or --all-databases option, entire databases are checked.
67
68       mysqlcheck has a special feature compared to other client programs. The
69       default behavior of checking tables (--check) can be changed by
70       renaming the binary. If you want to have a tool that repairs tables by
71       default, you should just make a copy of mysqlcheck named mysqlrepair,
72       or make a symbolic link to mysqlcheck named mysqlrepair. If you invoke
73       mysqlrepair, it repairs tables.
74
75       The following names can be used to change mysqlcheck default behavior.
76
77       ┌──────────────┬───────────────────────┐
78mysqlrepair   │ The default option is │
79       │              │ --repair              
80       ├──────────────┼───────────────────────┤
81mysqlanalyze  │ The default option is │
82       │              │ --analyze             
83       ├──────────────┼───────────────────────┤
84mysqloptimize │ The default option is │
85       │              │ --optimize            
86       └──────────────┴───────────────────────┘
87
88       mysqlcheck supports the following options, which can be specified on
89       the command line or in the [mysqlcheck] and [client] option file
90       groups.  The -c, -r, -a and -o options are exclusive to each other.
91
92--help, -?
93
94           Display a help message and exit.
95
96--all-databases, -A
97
98           Check all tables in all databases. This is the same as using the
99           --databases option and naming all the databases on the command
100           line.
101
102--all-in-1, -1
103
104           Instead of issuing a statement for each table, execute a single
105           statement for each database that names all the tables from that
106           database to be processed.
107
108--analyze, -a
109
110           Analyze the tables.
111
112--auto-repair
113
114           If a checked table is corrupted, automatically fix it. Any
115           necessary repairs are done after all tables have been checked.
116
117--character-sets-dir=path
118
119           The directory where character sets are installed.
120
121--check, -c
122
123           Check the tables for errors. This is the default operation.
124
125--check-only-changed, -C
126
127           Check only tables that have changed since the last check or that
128           have not been closed properly.
129
130--check-upgrade, -g
131
132           Invoke CHECK TABLE with the FOR UPGRADE option to check tables for
133           incompatibilities with the current version of the server. This
134           option automatically enables the --fix-db-names and
135           --fix-table-names options.
136
137--compress
138
139           Compress all information sent between the client and the server if
140           both support compression.
141
142--databases, -B
143
144           Process all tables in the named databases. Normally, mysqlcheck
145           treats the first name argument on the command line as a database
146           name and following names as table names. With this option, it
147           treats all name arguments as database names.
148
149--debug[=debug_options], -# [debug_options]
150
151           Write a debugging log. A typical debug_options string is
152           ´d:t:o,file_name´. The default is ´d:t:o´.
153
154--debug-check
155
156           Print some debugging information when the program exits.
157
158--debug-info
159
160           Print debugging information and memory and CPU usage statistics
161           when the program exits.
162
163--default-auth=name
164
165           Default authentication client-side plugin to use.
166
167--default-character-set=charset_name
168
169           Use charset_name as the default character set.
170
171--defaults-extra-file=filename
172
173           Set filename as the file to read default options from after the
174           global defaults files has been read.  Must be given as first
175           option.
176
177--defaults-file=filename
178
179           Set filename as the file to read default options from, override
180           global defaults files.  Must be given as first option.
181
182--extended, -e
183
184           If you are using this option to check tables, it ensures that they
185           are 100% consistent but takes a long time.
186
187           If you are using this option to repair tables, it will force using
188           the old, slow, repair with keycache method, instead of the much
189           faster repair by sorting.
190
191--fast, -F
192
193           Check only tables that have not been closed properly.
194
195--fix-db-names
196
197           Convert database names to the format used since MySQL 5.1. Only
198           database names that contain special characters are affected.
199
200--fix-table-names
201
202           Convert table names (including views) to the format used since
203           MySQL 5.1. Only table names that contain special characters are
204           affected.
205
206--flush,
207
208           Flush each table after check. This is useful if you don't want to
209           have the checked tables take up space in the caches after the
210           check.
211
212--force, -f
213
214           Continue even if an SQL error occurs.
215
216--host=host_name, -h host_name
217
218           Connect to the MariaDB server on the given host.
219
220--medium-check, -m
221
222           Do a check that is faster than an --extended operation. This finds
223           only 99.99% of all errors, which should be good enough in most
224           cases.
225
226--no-defaults
227
228           Do not read default options from any option file. This must be
229           given as the first argument.
230
231--optimize, -o
232
233           Optimize the tables.
234
235--password[=password], -p[password]
236
237           The password to use when connecting to the server. If you use the
238           short option form (-p), you cannot have a space between the option
239           and the password. If you omit the password value following the
240           --password or -p option on the command line, mysqlcheck prompts for
241           one.
242
243           Specifying a password on the command line should be considered
244           insecure. You can use an option file to avoid giving the password
245           on the command line.
246
247--persistent, -Z
248
249           Used with ANALYZE TABLE to append the option PERSISENT FOR ALL.
250
251--pipe, -W
252
253           On Windows, connect to the server via a named pipe. This option
254           applies only if the server supports named-pipe connections.
255
256--plugin-dir=name
257
258            Directory for client-side plugins.
259
260--port=port_num, -P port_num
261
262           The TCP/IP port number to use for the connection.
263
264--print-defaults
265
266           Print the program argument list and exit.  This must be given as
267           the first argument.
268
269--process-tables
270
271           Perform the requested operation on tables. Defaults to on; use
272           --skip-process-tables to disable.
273
274--process-views=val
275
276           Perform the requested operation (only CHECK VIEW or REPAIR VIEW).
277           Possible values are NO, YES (correct the checksum, if necessary,
278           add the mariadb-version field), UPGRADE_FROM_MYSQL (same as YES and
279           toggle the algorithm MERGE<->TEMPTABLE.
280
281--protocol={TCP|SOCKET|PIPE|MEMORY}
282
283           The connection protocol to use for connecting to the server. It is
284           useful when the other connection parameters normally would cause a
285           protocol to be used other than the one you want.
286
287--quick, -q
288
289           If you are using this option to check tables, it prevents the check
290           from scanning the rows to check for incorrect links. This is the
291           fastest check method.
292
293           If you are using this option to repair tables, it tries to repair
294           only the index tree. This is the fastest repair method.
295
296--repair, -r
297
298           Perform a repair that can fix almost anything except unique keys
299           that are not unique.
300
301--silent, -s
302
303           Silent mode. Print only error messages.
304
305--skip-database=db_name -s
306
307           Don't process the database (case-sensitive) specified as argument.
308
309--socket=path, -S path
310
311           For connections to localhost, the Unix socket file to use, or, on
312           Windows, the name of the named pipe to use.
313
314--ssl
315
316           Enable SSL for connection (automatically enabled with other flags).
317           Disable with --skip-ssl.
318
319--ssl-ca=name
320
321           CA file in PEM format (check OpenSSL docs, implies --ssl).
322
323--ssl-capath=name
324
325           CA directory (check OpenSSL docs, implies --ssl).
326
327--ssl-cert=name
328
329           X509 cert in PEM format (check OpenSSL docs, implies --ssl).
330
331--ssl-cipher=name
332
333           SSL cipher to use (check OpenSSL docs, implies --ssl).
334
335--ssl-key=name
336
337           X509 key in PEM format (check OpenSSL docs, implies --ssl).
338
339--ssl-crl=name
340
341           Certificate revocation list (check OpenSSL docs, implies --ssl).
342
343--ssl-crlpath=name
344
345           Certificate revocation list path (check OpenSSL docs, implies
346           --ssl).
347
348--ssl-verify-server-cert
349
350           Verify server's "Common Name" in its cert against hostname used
351           when connecting. This option is disabled by default.
352
353--tables
354
355           Override the --databases or -B option. All name arguments following
356           the option are regarded as table names.
357
358--use-frm
359
360           For repair operations on MyISAM tables, get the table structure
361           from the .frm file so that the table can be repaired even if the
362           .MYI header is corrupted.
363
364--user=user_name, -u user_name
365
366           The MariaDB user name to use when connecting to the server.
367
368--verbose, -v
369
370           Verbose mode. Print information about the various stages of program
371           operation.  Using one --verbose option will give you more
372           information about what mysqlcheck is doing.
373
374           Using two --verbose options will also give you connection
375           information.
376
377           Using it 3 times will print out all CHECK, RENAME and ALTER TABLE
378           during the check phase.
379
380--version, -V
381
382           Display version information and exit.
383
384--write-binlog
385
386           This option is enabled by default, so that ANALYZE TABLE, OPTIMIZE
387           TABLE, and REPAIR TABLE statements generated by mysqlcheck are
388           written to the binary log. Use --skip-write-binlog to cause
389           NO_WRITE_TO_BINLOG to be added to the statements so that they are
390           not logged. Use the --skip-write-binlog when these statements
391           should not be sent to replication slaves or run when using the
392           binary logs for recovery from backup.
393
395       Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.,
396       2010-2019 MariaDB Foundation
397
398       This documentation is free software; you can redistribute it and/or
399       modify it only under the terms of the GNU General Public License as
400       published by the Free Software Foundation; version 2 of the License.
401
402       This documentation is distributed in the hope that it will be useful,
403       but WITHOUT ANY WARRANTY; without even the implied warranty of
404       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
405       General Public License for more details.
406
407       You should have received a copy of the GNU General Public License along
408       with the program; if not, write to the Free Software Foundation, Inc.,
409       51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA or see
410       http://www.gnu.org/licenses/.
411
412

SEE ALSO

414       For more information, please refer to the MariaDB Knowledge Base,
415       available online at https://mariadb.com/kb/
416

AUTHOR

418       MariaDB Foundation (http://www.mariadb.org/).
419
420
421
422MariaDB 10.5                     27 June 2019                 MARIADB-CHECK(1)
Impressum