简体   繁体   English

MySQL DUMP无法导入。SQL错误

[英]MySQL DUMP not importing.. SQL ERROR

i have a Windows 2003 server with MySQL 5.5. 我有一个带有MySQL 5.5的Windows 2003服务器。 I am attempting to import a MySQL dump, however a Syntax error is being generated on the table creates. 我正在尝试导入MySQL转储,但是在创建的表上正在生成语法错误。 When I try the same query on my Linux 5.1 installation, there is no problem. 当我在Linux 5.1安装上尝试相同的查询时,没有问题。

The original data does not exist, so im somewhat stuck now.. 原始数据不存在,所以现在有点卡住了。

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 is 错误是

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

Should be: 应该:

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

The dump you are importing mostlikely comes from a different database which had a different setup. 您要导入的转储最有可能来自具有不同设置的其他数据库。 The character set specified I would assume is not valid is your current instance of mysql I would double check with this link: 我认为无效的指定字符集是您当前的mysql实例,我将对此链接进行仔细检查:

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

You can try to remove the last part to become 您可以尝试删除最后一部分成为

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`)
);

Which works fine here so it really is a character set configuration issue from your server. 在这里可以正常工作,因此这实际上是服务器中的字符集配置问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM