标签:
备份文件中索引的语法格式不对
从mysql备份出来的sql文件进行还原操作时报错,查看错误日志,内容如下:
Error Code: 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=InnoDB AUTO_INCREMENT=50913 DEFAULT CHARSET=gbk‘ at line 21
原因如下:
导出文件中的源码:
PRIMARY KEY (`row_id`) USING BTREE,
UNIQUE KEY `columnAindex` (`columnA`),
KEY `columnBindex` (`columnB`) USING HASH,
KEY `columnCindex` (`columnC`) USING BTREE,
...
正确的写法:
PRIMARY KEY USING BTREE (`row_id`),
UNIQUE KEY `columnAindex` (`columnA`),
KEY `columnBindex` USING HASH (`columnB`),
KEY `columnCindex` USING BTREE (`columnC`),
...
将导出文件中的所有索引类型(USING BTREE 等)挪到索引列(columnB等)的前面,就能够正常完成导入操作。
标签:
原文地址:http://www.cnblogs.com/shaven/p/4211832.html