MySQL raises this error when you try to drop or discard a tablespace that still contains tables, indexes, or undo logs.
ER_TABLESPACE_IS_NOT_EMPTY appears when MySQL refuses to drop or discard a tablespace that still holds objects. Confirm all tables are removed or moved, then retry the DROP TABLESPACE or ALTER TABLE ... DISCARD TABLESPACE command.
ER_TABLESPACE_IS_NOT_EMPTY
The message Tablespace `%s` is not empty means MySQL detected data inside the target tablespace right before executing a DROP TABLESPACE or DISCARD TABLESPACE operation.
The storage engine halts the operation to protect remaining tables, indexes, or undo logs from accidental loss.
The most common trigger is running ALTER TABLE mytable DISCARD TABLESPACE while rows or indexes are still resident in the .ibd file.
Administrators also see the error after issuing DROP TABLESPACE when child tables are still assigned to the same space.
First verify which objects live in the space using INFORMATION_SCHEMA.INNODB_SYS_TABLES or SHOW CREATE TABLE for each candidate table.
Once all objects are handled, reissue the DROP or DISCARD command and MySQL will complete successfully.
Partitioned tables often leave fragments in the target file. Use ALTER TABLE ... REMOVE PARTITIONING to consolidate before dropping.
When foreign key relationships exist, drop or move dependent tables to another space prior to the main operation.
Always audit the tablespace with INFORMATION_SCHEMA views before destructive operations.
Automate checks in deployment scripts to confirm space usage counts are zero before attempting DROP or DISCARD.
ER_IB_MSG_762 indicates a tablespace name collision during import. Resolve by renaming the .ibd file or choosing a unique space ID.
ER_TABLESPACE_EXISTS emerges when the target space already exists during CREATE TABLESPACE. Verify names and remove unused spaces.
Object residue left after incomplete DROP TABLE statements.
Hidden indexes or partition fragments still assigned to the space.
Active undo logs when using file-per-table and the space is targeted too early.
Appears when attempting to create a tablespace that already exists. Fix by dropping or renaming the existing space.
Raised when a referenced tablespace cannot be found on disk. Verify file paths and metadata.
The statement is written to the binary log only if it succeeds, so replicas stay consistent.
No. MySQL storage engine enforces it to protect data integrity.
It was introduced in 5.7.6 and persists in all later major versions.
Galaxy highlights dependent objects in an interactive schema tree, making it easy to confirm a tablespace is empty before executing destructive SQL.