MYSQL表分区操作错误1503解决方案
来源:原创
时间:2015-09-10
作者:脚本小站
分类:DB
A PRIMARY KEY MUST INCLUDE ALL COLUMNS IN THE TABLE'S PARTITIONING FUNCTION 这是错误信息。
MYSQL的分区字段,必须包含在主键字段内。就是要分区的字段必须为主键索引。
如下所示,season必须为主键索引。
-- list分区示例
CREATE TABLE IF NOT EXISTS `product` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `season` tinyint (1) not null default '2' comment '季节', primary key(id,season) )engine=MyISAM default charset=utf8 partition by list (season)( partition g1 values in (1), partition g2 values in (2), partition g3 values in (3), partition g4 values in (4) );
http://www.2cto.com/database/201503/380348.html
http://www.jb51.net/article/62290.htm