Oracle 5.0 Reference Manual page 177

Table of Contents

Advertisement

To rebuild a table by dumping and reloading it, use
reload the file:
shell>
mysqldump db_name t1 > dump.sql
shell>
mysql db_name < dump.sql
To rebuild all the tables in a single database, specify the database name without any following table
name:
shell>
mysqldump db_name > dump.sql
shell>
mysql db_name < dump.sql
To rebuild all tables in all databases, use the
shell>
mysqldump --all-databases > dump.sql
shell>
mysql < dump.sql
To rebuild a table with
ALTER
"changes" the table to use the storage engine that it already has. For example, if
use this statement:
mysql>
ALTER TABLE t1 ENGINE = MyISAM;
If you are not sure which storage engine to specify in the
to display the table definition.
TABLE
If you must rebuild a table because a table checking operation indicates that the table is corrupt or
needs an upgrade, you can use
For example, to repair a
mysql>
REPAIR TABLE t1;
For storage engines such as
a dump file and
mysql
For specifics about which storage engines
Syntax".
TABLE
mysqlcheck --repair
be a more convenient means of repairing tables because you can use the
[290]
all-databases
shell>
mysqlcheck --repair --databases db_name ...
shell>
mysqlcheck --repair --all-databases
For incompatibilities introduced in MySQL 5.1.24 by the fix for Bug #27877 that corrected the
and
utf8_general_ci
5.1.62, 5.5.21, and 5.6.5. Upgrade to one of those versions, then convert each affected table using
one of the following methods. In each case, the workaround altering affected columns to use the
utf8_general_mysql500_ci
original pre-5.1.24 ordering of
• To convert an affected table after a binary upgrade that leaves the table files in place, alter the table
to use the new collation. Suppose that the table
To convert the table at the table level, use a statement like this:
ALTER TABLE t1
CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci;
To apply the change on a column-specific basis, use a statement like this (be sure to repeat the
column definition as originally specified except for the
ALTER TABLE t1
MODIFY c1 CHAR(N) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci;
Rebuilding or Repairing Tables or Indexes
--all-databases
TABLE, use a "null" alteration; that is, an
REPAIR TABLE
table, use this statement:
MyISAM
that
InnoDB
REPAIR TABLE
to reload the file, as described earlier.
REPAIR TABLE
provides command-line access to the
option to repair all tables in specific databases or all databases, respectively:
collations, a workaround is implemented as of MySQL
ucs2_general_ci
and
ucs2_general_mysql500_ci
utf8_general_ci
157
to create a dump file and
mysqldump
[298]
option:
ALTER TABLE
ALTER TABLE
if that statement supports the table's storage engine.
does not support, use
supports, see
REPAIR TABLE
collations, which preserve the
and ucs2_general_ci.
contains one or more problematic
t1
clause):
COLLATE
mysql
statement that
is a
t1
MyISAM
statement, use
SHOW CREATE
to create
mysqldump
Section 13.7.2.6,
"REPAIR
statement. This can
[291]
or
--databases
columns.
utf8
to
table,
--

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents