I have a table like:
create table registrations(
id int not null auto_increment primary key,
name varchar(50),
mobile_number varchar(13))
engine=innodb
partit
Rearrange partitions doesn't require drop all existing partitions. You can specified the new partitioning in the ALTER TABLE
syntax directly, and no data will be lost.
ALTER TABLE registrations
PARTITION by RANGE(id) (
PARTITION p1 VALUES LESS THAN (10000),
PARTITION p2 VALUES LESS THAN (20000),
PARTITION p3 VALUES LESS THAN (30000),
PARTITION p4 VALUES LESS THAN (40000),
PARTITION p5 VALUES LESS THAN (MAXVALUE);
P.S. Tested with MySQL 5.7.11