#1064 - You have an error in your SQL syntax near 的错误
1CREATE TABLE `books` (
2 `yc_id` int(16) NOT NULL auto_increment,
3 `yc_name` varchar(16) character set gbk default NULL,
4 `yc_sex` varchar(4) character set gbk default NULL,
5 `yc_mail` varchar(30) character set gbk default NULL,
6 `yc_qq` varchar(15) character set gbk default NULL,
7 `yc_home` varchar(50) character set gbk default NULL,
8 `yc_content` mediumtext character set gbk,
9 `yc_ip` varchar(16) character set gbk default NULL,
10 `yc_sf` varchar(1) character set gbk default NULL,
11 `yc_time` varchar(100) character set gbk default NULL,
12 PRIMARY KEY (`yc_id`)
13) ENGINE=InnoDB DEFAULT CHARSET=gb2312 AUTO_INCREMENT=50 ;
14
2 `yc_id` int(16) NOT NULL auto_increment,
3 `yc_name` varchar(16) character set gbk default NULL,
4 `yc_sex` varchar(4) character set gbk default NULL,
5 `yc_mail` varchar(30) character set gbk default NULL,
6 `yc_qq` varchar(15) character set gbk default NULL,
7 `yc_home` varchar(50) character set gbk default NULL,
8 `yc_content` mediumtext character set gbk,
9 `yc_ip` varchar(16) character set gbk default NULL,
10 `yc_sf` varchar(1) character set gbk default NULL,
11 `yc_time` varchar(100) character set gbk default NULL,
12 PRIMARY KEY (`yc_id`)
13) ENGINE=InnoDB DEFAULT CHARSET=gb2312 AUTO_INCREMENT=50 ;
14
本地数据库MySQL - 5.0.22;网上数据库MySQL 3.23.58。
错误提示
#1064 - You have an error in your SQL syntax near 'CHARACTER SET gbk default NULL ,
`yc_sex` varchar( 4 ) CHARACTER SET gbk de' at line 2
很明显数据库不兼容造成的!我们要修改SQL语句,解决方案:
1CREATE TABLE `books` (
2 `yc_id` int(16) NOT NULL auto_increment,
3 `yc_name` varchar(16) default NULL,
4 `yc_sex` varchar(4) default NULL,
5 `yc_mail` varchar(30) default NULL,
6 `yc_qq` varchar(15) default NULL,
7 `yc_home` varchar(50) default NULL,
8 `yc_content` mediumtext,
9 `yc_ip` varchar(16) default NULL,
10 `yc_sf` varchar(1) default NULL,
11 `yc_time` varchar(100) default NULL,
12 PRIMARY KEY (`yc_id`)
13) TYPE=MyISAM;
14
2 `yc_id` int(16) NOT NULL auto_increment,
3 `yc_name` varchar(16) default NULL,
4 `yc_sex` varchar(4) default NULL,
5 `yc_mail` varchar(30) default NULL,
6 `yc_qq` varchar(15) default NULL,
7 `yc_home` varchar(50) default NULL,
8 `yc_content` mediumtext,
9 `yc_ip` varchar(16) default NULL,
10 `yc_sf` varchar(1) default NULL,
11 `yc_time` varchar(100) default NULL,
12 PRIMARY KEY (`yc_id`)
13) TYPE=MyISAM;
14