2013-10-29 21 views
0

即時得到這個錯誤:MySQL的語法錯誤: '使用BTREE)ENGINE = MyISAM的AUTO_INCREMENT = 9默認字符集= UTF8 AUTOINCREMENT ='

CREATE TABLE `pdc5l_usergroups` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Clave primaria', 
`parent_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'ID Lista de referencia adyacente', 
`lft` int(11) NOT NULL DEFAULT '0' COMMENT 'Anidadas conjunto lft.', 
`rgt` int(11) NOT NULL DEFAULT '0' COMMENT 'Anidadas conjunto rgt.', 
`title` varchar(100) NOT NULL DEFAULT '', 
PRIMARY KEY (`id`) , 
UNIQUE KEY `idx_usergroup_parent_title_lookup` (`parent_id` , `title`) , 
KEY `idx_usergroup_title_lookup` (`title`) , 
KEY `idx_usergroup_adjacency_lookup` (`parent_id`) , 
KEY `idx_usergroup_nested_set_lookup` (`lft` , `rgt`) USING BTREE 
) ENGINE = MYISAM AUTO_INCREMENT =9 DEFAULT CHARSET = utf8AUTOINCREMENT =9; 

MySQL said: Documentation 
#1064 - 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 'USING BTREE 
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 AUTOINCREMENT=' at line 11 

我嘗試了這些:

) ENGINE = MYISAM AUTO_INCREMENT =9 DEFAULT CHARSET = utf8 AUTO_INCREMENT =9; 
) ENGINE = MYISAM AUTOINCREMENT =9 DEFAULT CHARSET = utf8 AUTOINCREMENT =9; 
) ENGINE = MYISAM AUTOINCREMENT =9 DEFAULT CHARSET = utf8 AUTO_INCREMENT =9; 

,但我仍然得到錯誤。

的phpmyadmin這樣說:MySQL client version: 4.1.22

回答

1

這是MySQL的版本問題。你可以看到在這個bug問題:

http://bugs.mysql.com/bug.php?id=25162

Before MySQL 5.0.60, this option can be given only before the ON tbl_name clause. Use of the option in this position is deprecated as of 5.0.60 and support for it there will be removed in a future MySQL release. If an index_type option is given in both the earlier and later positions, the final option applies.

TYPE type_name is recognized as a synonym for USING type_name. However, USING is the preferred form.

欲瞭解更多詳情請看這裏:http://www.dbforums.com/mysql/1617755-using-btree.html

+1

有限的支持也同樣適用於[5.1分支(HTTP://dev.mysql。 COM/DOC/refman/5.1/EN /創建-table.html)。在這個分支上5.1.10添加了對這種語法的支持。 – RandomSeed