title: Mysql reclaim mysql disk space after deleting rows
body: <p>First of all sorry for repeatating this repeated question as it has been asked numerous times already. I have gone through those questions and answers.</p>
  
  <p>I have a table on production environment of size approx 159 GB and now I want to migrate MySQL to another server. But since total DB size is more than 300 GB I am not able to migrate it easily. So I am trying to reclaim space by deleting records from MySQL. I deleted more than 70 % records from this table and tried <code>OPTIMIZE TABLE</code> but its giving an error as : </p>
  
  <pre><code> mysql&gt; OPTIMIZE TABLE table_name;
  +--------------------------------------+----------+----------+-----------------------+
  | Table | Op | Msg_type | Msg_text |
  +--------------------------------------+----------+----------+-----------------------+
  | table_name | optimize | note | Table does not support optimize, doing recreate + analyze instead |
  | table_name | optimize | error | The table 'table_name' is full |
  | table_name | optimize | status | Operation failed |
  +--------------------------------------+----------+----------+-----------------------+
  </code></pre>
  
  <p>innodb_file_per_table is set to ON </p>
  
  <pre><code>SHOW VARIABLES LIKE '%innodb_file_per_table%';
  Variable_name          Value   
  ---------------------  --------
  innodb_file_per_table  ON      
  </code></pre>
  
  <p>Mysql Version: <code>5.7.28-log</code></p>
  
  <p>I read somewhere that <code>alter table</code> will help however it slows down all MySQL queries.</p>
  
  <p>In one answer I read that copying data in another table and then renaming it and deleting original table (which I assume <code>OPTIMIZE TABLE</code> does internally) will help but doing so will need downtime. </p>
  
  <p>Is there any other way which I can achieve this.?</p>