Sep 13, 2018

How to move MySQL table to another location

CREATE TABLE d.t_new (
  //... the same as the table you are going to move
)
DATA DIRECTORY ='/your/new/location'
ENGINE=InnoDB AUTO_INCREMENT=68050918 DEFAULT CHARSET=utf8;

INSERT low_priority d.`t_new`  SELECT * FROM d.`t`;

rename table d.t to d.t_old, d.t_new to d.t;

Make sure everything OK.

DROP TABLE `d`.`t_old`;

See also: