title: How to move InnoDB table to another drive?
body: <p>I have MySQL running on SSDs, SSDs that I'm about to run out of space on. My webhost overcharges for SSDs and the majority of the data in MySQL is "archived" data (i.e. data that isn't actively used). I have larger HDDs that can hold this data. As such, I want to be able to move specific InnoDB tables from the SSDs to the HDDs.</p>
  
  <p>One solution I've thought about and researched is moving the individual .ibd files (I have innodb_file_per_table enabled) for the specific tables in question to the HDDs and then symlink. However, researching this, it looks like that is a bad idea for InnoDB.</p>
  
  <p>I've also seen that since 5.6, MySQL supports the DATA DIRECTORY command:</p>
  
  <blockquote>
    <p>To create a new InnoDB file-per-table tablespace in a specific
    location outside the MySQL data directory, use the DATA DIRECTORY =
    absolute_path_to_directory clause of the CREATE TABLE statement.</p>
    
    <p>Plan the location in advance, because you cannot use the DATA
    DIRECTORY clause with the ALTER TABLE statement. The directory you
    specify could be on another storage device with particular performance
    or capacity characteristics, such as a fast SSD or a high-capacity
    HDD.</p>
  </blockquote>
  
  <p>The problem is, it looks like this is only supported for <em>new</em> tables. I want to do it for existing tables. Any tips on how? I'm running Percona MySQL, if it helps.</p>
  
  <p>Thanks!</p>
  
  <p><strong>UPDATE:</strong> Here is what I tried, but I'm getting a syntax error:</p>
  
  <p><code>CREATE TABLE abc_2 LIKE abc ENGINE=InnoDB DATA DIRECTORY='/xxx/mysql/archive/'</code></p>