通过.sql文件向数据库中导入表时出错,错误信息如下:
SQL 查询 : CREATE TABLE `new_article` (`id` int( 11 ) NOT NULL AUTO_INCREMENT ,
`fid` tinyint( 4 ) NOT NULL ,
`sid` tinyint( 4 ) NOT NULL ,
`title` varchar( 100 ) NOT NULL ,
`date` int( 11 ) NOT NULL ,
`count` int( 11 ) NOT NULL ,
`content` text NOT NULL ,
`type` char( 4 ) NOT NULL ,
`top` tinyint( 4 ) NOT NULL ,
PRIMARY KEY ( `id` )
)ENGINE = InnoDB AUTO_INCREMENT =878DEFAULT CHARSET = gbk MySQL 返回:
#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 'DEFAULT CHARSET=gbk' at line 12这个phpadmin在远端服务器上,我是通过链接地址访问的,在首页中有如下版本信息:
phpMyAdmin 2.5.4
MySQL 4.0.22-standard 在 localhost 以 xcb@localhost 的身份执行
我本地机上php版本是5.2.10
SQL 查询 : CREATE TABLE `new_article` (`id` int( 11 ) NOT NULL AUTO_INCREMENT ,
`fid` tinyint( 4 ) NOT NULL ,
`sid` tinyint( 4 ) NOT NULL ,
`title` varchar( 100 ) NOT NULL ,
`date` int( 11 ) NOT NULL ,
`count` int( 11 ) NOT NULL ,
`content` text NOT NULL ,
`type` char( 4 ) NOT NULL ,
`top` tinyint( 4 ) NOT NULL ,
PRIMARY KEY ( `id` )
)ENGINE = InnoDB AUTO_INCREMENT =878DEFAULT CHARSET = gbk MySQL 返回:
#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 'DEFAULT CHARSET=gbk' at line 12这个phpadmin在远端服务器上,我是通过链接地址访问的,在首页中有如下版本信息:
phpMyAdmin 2.5.4
MySQL 4.0.22-standard 在 localhost 以 xcb@localhost 的身份执行
我本地机上php版本是5.2.10
`fid` TINYINT( 4 ) NOT NULL ,
`sid` TINYINT( 4 ) NOT NULL ,
`title` VARCHAR( 100 ) NOT NULL ,
`date` INT( 11 ) NOT NULL ,
`count` INT( 11 ) NOT NULL ,
`content` TEXT NOT NULL ,
`type` CHAR( 4 ) NOT NULL ,
`top` TINYINT( 4 ) NOT NULL ,
PRIMARY KEY ( `id` )
)ENGINE = INNODB AUTO_INCREMENT =878 DEFAULT CHARSET = gbk
->
-> `id` int( 11 ) NOT NULL AUTO_INCREMENT ,
-> `fid` tinyint( 4 ) NOT NULL ,
-> `sid` tinyint( 4 ) NOT NULL ,
-> `title` varchar( 100 ) NOT NULL ,
-> `date` int( 11 ) NOT NULL ,
-> `count` int( 11 ) NOT NULL ,
-> `content` text NOT NULL ,
-> `type` char( 4 ) NOT NULL ,
-> `top` tinyint( 4 ) NOT NULL ,
-> PRIMARY KEY ( `id` )
-> )ENGINE = InnoDB AUTO_INCREMENT =878 DEFAULT CHARSET = gbk ;
Query OK, 0 rows affected (0.39 sec)mysql>
CREATE TABLE `new_article` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fid` tinyint(4) NOT NULL,
`sid` tinyint(4) NOT NULL,
`title` varchar(100) NOT NULL,
`date` int(11) NOT NULL,
`count` int(11) NOT NULL,
`content` text NOT NULL,
`type` char(4) NOT NULL,
`top` tinyint(4) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=878 DEFAULT CHARSET=gbk;
你的版本到底是什么? select version() 看一下。估计你服务器上是MySQL 4.0.22
4.0 还不支持 CHARACTER SET ,4.1 开始才行。在你的sql文件中,将这些删除试一下。