数据库数据同步错误请帮忙

时间:2012-03-01 17:55:51

标签: mysql

CREATE TABLE IF NOT EXISTS userdata(
  UID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, 
  Username CHAR (50) NOT NULL, 
  DisplayName CHAR (50), 
  Signature CHAR (255), 
  PRIMARY KEY(UID), 
  UNIQUE(UID,Username), 
  INDEX(UID)
)
CREATE TABLE IF NOT EXISTS addressbook(
  EID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, 
  UID BIGINT UNSIGNED NOT NULL, 
  Display CHAR (50), 
  E_Mail CHAR (100) NOT NULL, 
  Info CHAR (255), 
  PRIMARY KEY(EID), 
  UNIQUE(EID), 
  INDEX(EID,UID,Display,E_Mail)
)

这里的错误是因为我无法插入mysql

1 个答案:

答案 0 :(得分:0)

在每个单独的SQL语句后添加分号:

CREATE TABLE IF NOT EXISTS userdata(
  UID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, 
  Username CHAR (50) NOT NULL, 
  DisplayName CHAR (50), 
  Signature CHAR (255), 
  PRIMARY KEY(UID), 
  UNIQUE(UID,Username), 
  INDEX(UID)
);

CREATE TABLE IF NOT EXISTS addressbook(
  EID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, 
  UID BIGINT UNSIGNED NOT NULL, 
  Display CHAR (50), 
  E_Mail CHAR (100) NOT NULL, 
  Info CHAR (255), 
  PRIMARY KEY(EID), 
  UNIQUE(EID), 
  INDEX(EID,UID,Display,E_Mail)
);