I have this version of MySQL server:

mysql  Ver 8.0.15 for Linux on x86_64 (MySQL Community Server - GPL)

I use a some large tables. When I truncate database with truncate database <name>, I check the hard disk space and I've noticed my disk space is not reclaimed.

This is more information on my server:

SHOW VARIABLES LIKE 'innodb_file_per_table';
'innodb_file_per_table', 'ON'`

Any idea to resolve this ?

  1. You need to "reorganize/rebuild" the table truncated which can be achieved by below.

    mysql> OPTIMIZE table table_name;

for InnoDB tables, it run under ALTER operation.

reference: https://dev.mysql.com/doc/refman/8.0/en/optimize-table.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.