您的位置:首页 > 数据库 > MySQL

mysql4.0数据库导入到mysql5.0数据库中错误

2012-05-30 11:29 267 查看
因工作需求,需要把mysql4.0.17中的数据库导入到mysql-5.5.21中,但是在导入的错误中遇到了大量错误,现将错误贴出供自己以后方便!!!

1.第一次导入

[root@CentOS62 ~]# mysql -uroot -p ceshi < /root/download/9999.sql

ERROR 1064 (42000) at line 11: 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

'TYPE=MyISAM' at line 10


解决办法:

原因:编写数据库的版本比当前安装的版本不相同。

解决:

1、用文本编辑器打开9999.sql;

2、查找/替换,将数据库文件内的所有TYPE=MyISAM修改为ENGINE=MyISAM,保存退出;

3、重新导入9999.sql即可。

2.第二次导入

[root@CentOS62 ~]# mysql -uroot -p ceshi < /root/download/8888.sql

ERROR 1064 (42000) at line 89: 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

'TYPE=InnoDB' at line 10


解决办法:

TYPE=InnoDB修改成ENGINE=InnoDB;

3.第三次导入

[root@CentOS62 ~]# mysql -uroot -p ceshi < /root/download/7777.sql

ERROR 1064 (42000) at line 368: 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 'read

int(11) default '0',

content text,

PRIMARY KEY (id)

) ENGINE = MYISAM' at line 8



解决办法:

CREATE TABLE news (

`id` int(11) NOT NULL auto_increment,

`type` int(11) default NULL,

`title` varchar(200) default NULL,

`source` varchar(50) default NULL,

`author` varchar(50) default NULL,

`addtime` int(11) default '0',

`read` int(11) default '0',

`content` text,

PRIMARY KEY (`id`)

)ENGINE=MyISAM;


原因:一般不要用关键字(read属于关键字)做表明,如果关键字做表名,sql语句中要使用[](或是``)括起来

导入成功
本文出自 “八爪鱼” 博客,请务必保留此出处http://bazhuayu.blog.51cto.com/1441282/882404
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: