2016-12-29 205 views
0

通过命令行执行SQL时发生错误。问题是什么?语法看起来好像没有错。我该怎么办?MySQL创建表命令发生错误1064(42000)

[[email protected] bin]# mysql -u dubbom -D dubbomonitor -p -t </tmp/create.sql 
Enter password: 
ERROR 1064 (42000) at line 3: 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, 
    KEY `index_method` (`method`) USING BTREE, 
    KEY `index_invoke_da' at line 17 

[[email protected] bin]# cat /tmp/create.sql 
use dubbomonitor; 
DROP TABLE IF EXISTS `dubbo_invoke`; 
CREATE TABLE `dubbo_invoke` (
    `id` varchar(255) NOT NULL DEFAULT '', 
    `invoke_date` date NOT NULL, 
    `service` varchar(255) DEFAULT NULL, 
    `method` varchar(255) DEFAULT NULL, 
    `consumer` varchar(255) DEFAULT NULL, 
    `provider` varchar(255) DEFAULT NULL, 
    `type` varchar(255) DEFAULT '', 
    `invoke_time` bigint(20) DEFAULT NULL, 
    `success` int(11) DEFAULT NULL, 
    `failure` int(11) DEFAULT NULL, 
    `elapsed` int(11) DEFAULT NULL, 
    `concurrent` int(11) DEFAULT NULL, 
    `max_elapsed` int(11) DEFAULT NULL, 
    `max_concurrent` int(11) DEFAULT NULL, 
    PRIMARY KEY (`id`), 
    KEY `index_service` (`service`) USING BTREE, 
    KEY `index_method` (`method`) USING BTREE, 
    KEY `index_invoke_date` (`invoke_date`) USING BTREE, 
    KEY `index_invoke_time` (`invoke_time`) USING BTREE 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT; 
+2

你使用的是哪个版本的mysql? –

+0

我的同事安装了MySQL 5.1,我知道问题在哪里,谢谢。 – Tan

+0

@谭是什么问题?您可以将其作为答案发布 – jophab

回答

0

MySQL版本太旧,某些高版本的语法不受支持。

谢谢你,@Wes Doyle