mysql 对已有表分区_mysql怎么对先有表进行分区
mysql如何對先有表進行分區(qū)?
有一張表,已經(jīng)創(chuàng)建了,是一張普通的表,先要對這張表進行hash分區(qū),我用一下語句創(chuàng)建提示錯誤:
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
難道對普通標不能進行分區(qū),必須要在創(chuàng)建表的時候指定分區(qū)類型?
------解決方案--------------------
你的表名是什么? 如果是33則需要加上 33 反引號(注意不是單引號)
SQL code
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: 0 mysql>
------解決方案--------------------
33為表名加引號。
alter table tb
partition by hash(id)
partitions 2;
------解決方案--------------------
33表名加''
alter table tb
partition by hash(id)
partitions 2;
歡迎大家閱讀《mysql怎么對先有表進行分區(qū)》,跪求各位點評,by 搞代碼
原創(chuàng)文章,轉(zhuǎn)載請注明: 轉(zhuǎn)載自搞代碼
微信 賞一包辣條吧~
支付寶 賞一聽可樂吧~
總結(jié)
以上是生活随笔為你收集整理的mysql 对已有表分区_mysql怎么对先有表进行分区的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 309 元,黑峡谷推出 X4 机械键盘:
- 下一篇: 如何查看mysql my.ini_MyS