1217
*************************** 5. row ***************************
Engine: BLACKHOLE
Support: YES
Comment: /dev/null storage engine (anything you write to it disappears)
...
This chapter describes each of the MySQL storage engines except for
NDBCLUSTER
, which is covered
in
Chapter 17, MySQL Cluster
.
For information about storage engine support offered in commercial MySQL Server binaries, see
MySQL Enterprise Server 5.1
, on the MySQL Web site. The storage engines available might depend
on which edition of Enterprise Server you are using.
For answers to some commonly asked questions about MySQL storage engines, see
Section B.2,
“MySQL 5.0 FAQ: Storage Engines”
.
When you create a new table, you can specify which storage engine to use by adding an
ENGINE
or
TYPE
table option to the
CREATE TABLE
statement:
CREATE TABLE t (i INT) ENGINE = INNODB;
CREATE TABLE t (i INT) TYPE = MEMORY;
The older term
TYPE
is supported as a synonym for
ENGINE
for backward compatibility, but
ENGINE
is
the preferred term and
TYPE
is deprecated.
If you omit the
ENGINE
or
TYPE
option, the default storage engine is used. Normally, this is
MyISAM
,
but you can change it by using the
--default-storage-engine
[405]
or
--default-table-
type
[406]
server startup option, or by setting the
default-storage-engine
or
default-table-
type
option in the
my.cnf
configuration file.
You can set the default storage engine to be used during the current session by setting the
storage_engine
[497]
or
table_type
[499]
variable:
SET storage_engine=MYISAM;
SET table_type=BDB;
When MySQL is installed on Windows using the MySQL Configuration Wizard, the
InnoDB
or
MyISAM
storage engine can be selected as the default. See
Section 2.10.3.5, “The Database Usage Dialog”
.
To convert a table from one storage engine to another, use an
ALTER TABLE
statement that indicates
the new engine:
ALTER TABLE t ENGINE = MYISAM;
ALTER TABLE t TYPE = BDB;
See
Section 13.1.10, “
CREATE TABLE
Syntax”
, and
Section 13.1.4, “
ALTER TABLE
Syntax”
.
If you try to use a storage engine that is not compiled in or that is compiled in but deactivated, MySQL
instead creates a table using the default storage engine. This behavior is convenient when you want
to copy tables between MySQL servers that support different storage engines. (For example, in a
replication setup, perhaps your master server supports transactional storage engines for increased
safety, but the slave servers use only nontransactional storage engines for greater speed.)
This automatic substitution of the default storage engine for unavailable engines can be confusing for
new MySQL users. A warning is generated whenever a storage engine is automatically changed.
For new tables, MySQL always creates an
.frm
file to hold the table and column definitions. The
table's index and data may be stored in one or more other files, depending on the storage engine. The
server creates the
.frm
file above the storage engine level. Individual storage engines create any
additional files required for the tables that they manage.
A database may contain tables of different types. That is, tables need not all be created with the same
storage engine.
Transaction-safe tables (TSTs) have several advantages over nontransaction-safe tables (NTSTs):
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...