有一张表,已经创建了,是一张普通的表,先要对这张表进行hash分区,我用一下语句创建提示错误:
mysql> alter table 33
    -> partition by hash(id)
    -> partitions 2;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '33
partition by hash(id)
partitions 2' at line 1难道对普通标不能进行分区,必须要在创建表的时候指定分区类型?

解决方案 »

  1.   

    你的表名是什么? 如果是33则需要加上 `33` 反引号(注意不是单引号)
    mysql> create table x  (
        -> id int primary key,
        -> c int
        -> ) engine=myisam;
    Query OK, 0 rows affected (0.10 sec)mysql> alter table x
        -> PARTITION BY HASH(id)
        -> PARTITIONS 2;
    Query OK, 0 rows affected (0.15 sec)
    Records: 0  Duplicates: 0  Warnings: 0mysql>
      

  2.   

    show create table `33`看下,或者查下information_schema库中的PARTITIONS表,或者直接到数据目录下看数据文件,
      

  3.   

    表中加入''引号,
    show table '33';
    alter table 33
      -> partition by hash(id)
      -> partitions 2;
    alter table '33'
    partition by  hash(id)
    partitions 2;