MySQL DUMP不导入.. SQL错误

时间:2012-01-18 18:07:15

标签: mysql windows mysqldump

我有一个带有MySQL 5.5的Windows 2003服务器。我正在尝试导入MySQL转储,但是在表创建时会生成语法错误。当我在Linux 5.1安装上尝试相同的查询时,没有问题。

原始数据不存在,所以我现在有点卡住..

CREATE TABLE `articledata` 
(
    `ID` integer (10) UNSIGNED  NOT NULL AUTO_INCREMENT , 
    `templateid` integer (11) NOT NULL DEFAULT 0, 
    `issueid` integer (11) NOT NULL DEFAULT 0, 
    `articletitle` varchar (255) NOT NULL, 
    `articletext` text NOT NULL, 
    `articlepic1` varchar (255) NOT NULL, 
    `articlepriority` integer (11) NOT NULL DEFAULT 0, 
    `articledetails` text NOT NULL, 
    `articledetailstitle2` varchar (255) NOT NULL, 
    `articledetails2` text NOT NULL, 
    `articlepic2` varchar (255) NOT NULL, 
    `articledetailstitle` varchar (255) NOT NULL, 
    `articlepic1a` varchar (255) NOT NULL, 
    `subclusterid` integer (11) NOT NULL,
    PRIMARY KEY (`ID`)
) TYPE=InnoDB CHARACTER SET latin1 COLLATE latin1_swedish_ci;

错误是

ERROR 1064 <42000>: You have an error in your SQL syntax near: TYPE=InnoDB CHARACTER SET latin1 COLLATE latin1_swedish_ci;

2 个答案:

答案 0 :(得分:3)

应该是:

# Notice Type should be Engine
)ENGINE=InnoDB DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;

答案 1 :(得分:0)

您最常导入的转储来自另一个具有不同设置的数据库。我认为无效的字符集是你当前的mysql实例我会仔细检查这个链接:

http://dev.mysql.com/doc/refman/5.5/en/charset-server.html

您可以尝试删除最后一部分以成为

CREATE TABLE `articledata` 
(
    `ID` integer (10) UNSIGNED  NOT NULL AUTO_INCREMENT , 
    `templateid` integer (11) NOT NULL DEFAULT 0, 
    `issueid` integer (11) NOT NULL DEFAULT 0, 
    `articletitle` varchar (255) NOT NULL, 
    `articletext` text NOT NULL, 
    `articlepic1` varchar (255) NOT NULL, 
    `articlepriority` integer (11) NOT NULL DEFAULT 0, 
    `articledetails` text NOT NULL, 
    `articledetailstitle2` varchar (255) NOT NULL, 
    `articledetails2` text NOT NULL, 
    `articlepic2` varchar (255) NOT NULL, 
    `articledetailstitle` varchar (255) NOT NULL, 
    `articlepic1a` varchar (255) NOT NULL, 
    `subclusterid` integer (11) NOT NULL,
    PRIMARY KEY (`ID`)
);

这里的工作正常,所以它确实是来自服务器的字符集配置问题。