首页 > MySQL报这个错误,是哪里错了呢?[Err] 1064 - You have an error .....

MySQL报这个错误,是哪里错了呢?[Err] 1064 - You have an error .....

下面这个错误是哪里错了呢?

[SQL]
CREATE TABLE `tn_Users` (
UserId BigInt NOT NULL,
UserName Varchar(64) NOT NULL,
Password Varchar(128) NOT NULL,
PasswordFormat Int(11) NOT NULL DEFAULT '1',
PasswordQuestion Varchar(64) NOT NULL DEFAULT '',
PasswordAnswer Varchar(64) NOT NULL DEFAULT '',
AccountEmail Varchar(64) NOT NULL DEFAULT '',
IsEmailVerified TinyInt NOT NULL DEFAULT '0',
AccountMobile Varchar(64) NOT NULL DEFAULT '',
IsMobileVerified TinyInt NOT NULL DEFAULT '0',
TrueName Varchar(64) NOT NULL DEFAULT '',
NickName Varchar(64) NOT NULL DEFAULT '',
ForceLogin TinyInt NOT NULL DEFAULT '0',
IsActivated TinyInt NOT NULL DEFAULT '1',
DateCreated DateTime NOT NULL,
IpCreated Varchar(64) NOT NULL DEFAULT '',
UserType TinyInt NOT NULL DEFAULT '1',
LastActivityTime DateTime NOT NULL,
LastAction Varchar(512) NOT NULL DEFAULT '',
IpLastActivity Varchar(64) NOT NULL DEFAULT '',
IsBanned TinyInt NOT NULL DEFAULT '0',
BanReason Varchar(64) NOT NULL,
BanDeadline DateTime NOT NULL,
IsModerated TinyInt NOT NULL DEFAULT '0',
IsForceModerated TinyInt NOT NULL DEFAULT '0',
DatabaseQuota Int(11) NOT NULL DEFAULT '0',
DatabaseQuotaUsed Int(11) NOT NULL DEFAULT '0',
ThemeAppearance Varchar(128) NOT NULL,
IsUseCustomStyle TinyInt NOT NULL DEFAULT '0',
Avatar Varchar(128) NOT NULL DEFAULT '',
FollowedCount Int(11) NOT NULL DEFAULT '0',
FollowerCount Int(11) NOT NULL DEFAULT '0',
ExperiencePoints Int(11) NOT NULL DEFAULT '0',
ReputationPoints Int(11) NOT NULL DEFAULT '0',
TradePoints Int(11) NOT NULL DEFAULT '0',
TradePoints2 Int(11) NOT NULL DEFAULT '0',
TradePoints3 Int(11) NOT NULL DEFAULT '0',
TradePoints4 Int(11) NOT NULL DEFAULT '0',
FrozenTradePoints Int(11) NOT NULL DEFAULT '0',
'[Rank]' Int(11) NOT NULL DEFAULT '1',
AuditStatus Smallint NOT NULL DEFAULT '1',
DateAvatar Bigint NOT NULL  DEFAULT '1',
KEY `IX_AccountEmail` (`AccountEmail`),
KEY `IX_AccountMobile` (`AccountMobile`),
KEY `IX_FollowedCount` (`FollowedCount`),
KEY `IX_FollowerCount` (`FollowerCount`),
KEY `IX_Rank` (`[Rank]`),
KEY `IX_UserName` (`UserName`),
PRIMARY KEY (`UserId`)
)ENGINE=innodb DEFAULT CHARSET=utf8;
[Err] 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 ''[Rank]' Int(11) NOT NULL DEFAULT '1',
AuditStatus Smallint NOT NULL DEFAULT '1' at line 41

关键词用反引号。


字段名不能使用引号,应该使用`(esc键下面的那个键)


把·[RANK] 外面的中括号去掉


CREATE TABLE tn_Users (
UserId BigInt NOT NULL,
UserName Varchar(64) NOT NULL,
Password Varchar(128) NOT NULL,
PasswordFormat Int(11) NOT NULL DEFAULT '1',
PasswordQuestion Varchar(64) NOT NULL DEFAULT '',
PasswordAnswer Varchar(64) NOT NULL DEFAULT '',
AccountEmail Varchar(64) NOT NULL DEFAULT '',
IsEmailVerified TinyInt NOT NULL DEFAULT '0',
AccountMobile Varchar(64) NOT NULL DEFAULT '',
IsMobileVerified TinyInt NOT NULL DEFAULT '0',
TrueName Varchar(64) NOT NULL DEFAULT '',
NickName Varchar(64) NOT NULL DEFAULT '',
ForceLogin TinyInt NOT NULL DEFAULT '0',
IsActivated TinyInt NOT NULL DEFAULT '1',
DateCreated DateTime NOT NULL,
IpCreated Varchar(64) NOT NULL DEFAULT '',
UserType TinyInt NOT NULL DEFAULT '1',
LastActivityTime DateTime NOT NULL,
LastAction Varchar(512) NOT NULL DEFAULT '',
IpLastActivity Varchar(64) NOT NULL DEFAULT '',
IsBanned TinyInt NOT NULL DEFAULT '0',
BanReason Varchar(64) NOT NULL,
BanDeadline DateTime NOT NULL,
IsModerated TinyInt NOT NULL DEFAULT '0',
IsForceModerated TinyInt NOT NULL DEFAULT '0',
DatabaseQuota Int(11) NOT NULL DEFAULT '0',
DatabaseQuotaUsed Int(11) NOT NULL DEFAULT '0',
ThemeAppearance Varchar(128) NOT NULL,
IsUseCustomStyle TinyInt NOT NULL DEFAULT '0',
Avatar Varchar(128) NOT NULL DEFAULT '',
FollowedCount Int(11) NOT NULL DEFAULT '0',
FollowerCount Int(11) NOT NULL DEFAULT '0',
ExperiencePoints Int(11) NOT NULL DEFAULT '0',
ReputationPoints Int(11) NOT NULL DEFAULT '0',
TradePoints Int(11) NOT NULL DEFAULT '0',
TradePoints2 Int(11) NOT NULL DEFAULT '0',
TradePoints3 Int(11) NOT NULL DEFAULT '0',
TradePoints4 Int(11) NOT NULL DEFAULT '0',
FrozenTradePoints Int(11) NOT NULL DEFAULT '0',
Rank Int(11) NOT NULL DEFAULT '1',
AuditStatus Smallint NOT NULL DEFAULT '1',
DateAvatar Bigint NOT NULL DEFAULT '1',
KEY IX_AccountEmail (AccountEmail),
KEY IX_AccountMobile (AccountMobile),
KEY IX_FollowedCount (FollowedCount),
KEY IX_FollowerCount (FollowerCount),
KEY IX_Rank (Rank),
KEY IX_UserName (UserName),
PRIMARY KEY (UserId)
)ENGINE=innodb DEFAULT CHARSET=utf8;

【热门文章】
【热门文章】