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