MySQL: DELETE didn't shrink DB size, nor table size
There are several ways to delete 'most' of a table.  Perhaps the best is
SET @@innodb_file_per_table = ON; -- if this is not already on  (optional)

CREATE TABLE new LIKE real;
INSERT INTO new
    SELECT * FROM real
        WHERE ... -- the rows you want to _keep_;
RENAME TABLE real TO old,
             new TO real;
DROP TABLE old;

More techiques:  http://mysql.rjweb.org/doc.php/deletebig
If this will be a recurring task, see the partitioning suggestion in that link.