Pre-General Availability Draft: 2017-05-29
All tables must be dropped from the tablespace prior to a
DROP TABLESPACE operation. If the tablespace is
DROP TABLESPACE returns an error.
case-sensitive identifier in MySQL.
ENGINE: Defines the storage engine that uses
the tablespace, where
the name of the storage engine. Currently, only the
InnoDB storage engine is supported. You do not
need to specify
ENGINE = InnoDB if
InnoDB is defined as the default storage engine
DROP TABLESPACE is supported with
InnoDB. In earlier releases,
which is the MySQL Cluster storage engine.
TABLESPACE will support
in MySQL 5.7 when MySQL Cluster is branched from the MyQL 5.7 code
base. The latest version of MySQL Cluster is based on MySQL 5.6.
InnoDBtablespace is not deleted automatically when the last table in the tablespace is dropped. The tablespace must be dropped explicitly using
DROP DATABASEoperation can drop tables that belong to a general tablespace but it cannot drop the tablespace, even if the operation drops all tables that belong to the tablespace. The tablespace must be dropped explicitly using
Similar to the system tablespace, truncating or dropping tables stored in a general tablespace creates free space internally in the general tablespace .ibd data file which can only be used for new
InnoDBdata. Space is not released back to the operating system as it is for file-per-table tablespaces.
This example demonstrates how to drop an
general tablespace. The general tablespace
is created with a single table. Before dropping the tablespace,
the table must be dropped.
mysql> CREATE TABLESPACE `ts1` ADD DATAFILE 'ts1.ibd' Engine=InnoDB; Query OK, 0 rows affected (0.01 sec) mysql> CREATE TABLE t1 (c1 INT PRIMARY KEY) TABLESPACE ts10 Engine=InnoDB; Query OK, 0 rows affected (0.02 sec) mysql> DROP TABLE t1; Query OK, 0 rows affected (0.01 sec) mysql> DROP TABLESPACE ts1; Query OK, 0 rows affected (0.01 sec)