我在运行SQL语句时出现了#1064错误

来源:百度知道 编辑:UC知道 时间:2024/07/12 17:10:27
运行的语句:
CREATE TABLE IF NOT EXISTS `uchome_app_ask` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`typeid` smallint(4) NOT NULL default '0',
`uid` int(11) NOT NULL default '0',
`username` varchar(50) NOT NULL default '',
`content` text,
`tag` varchar(250) default NULL,
`dateline` int(11) NOT NULL default '0',
`score` smallint(4) NOT NULL default '0',
`view_count` int(11) NOT NULL default '0',
`reply_count` int(11) NOT NULL default '0',
`status` smallint(1) NOT NULL default '0',
`msg` text,
PRIMARY KEY (`id`),
KEY `typeid` (`typeid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf-8;

出现的错误提示:
#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=utf-8'

MySQL用utf8, 而不是utf-8
改为:

CREATE TABLE IF NOT EXISTS `uchome_app_ask` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`typeid` smallint(4) NOT NULL default '0',
`uid` int(11) NOT NULL default '0',
`username` varchar(50) NOT NULL default '',
`content` text,
`tag` varchar(250) default NULL,
`dateline` int(11) NOT NULL default '0',
`score` smallint(4) NOT NULL default '0',
`view_count` int(11) NOT NULL default '0',
`reply_count` int(11) NOT NULL default '0',
`status` smallint(1) NOT NULL default '0',
`msg` text,
PRIMARY KEY (`id`),
KEY `typeid` (`typeid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;