MySQL:无法将Sakila(样本)正向工程转换为服务器

时间:2010-08-25 15:50:45

标签: sql mysql

下载Sakila(示例)之后,我尝试将此Schema工程转发到服务器中,但只有部分表被设计。后来同步也下降了。请看下面的报告告诉我是错的。我没有编程背景。

如果有人成功完成了Sakila的工程师,请告诉我。

在服务器

中执行SQL脚本
  

错误:错误1253:COLLATION'latin1_swedish_ci'对CHARACTER SET'utf8'无效

脚本:

CREATE  TABLE IF NOT EXISTS `sakila`.`customer` (
  `customer_id` SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT ,
  `store_id` TINYINT(3) UNSIGNED NOT NULL ,
  `first_name` VARCHAR(45) NOT NULL ,
  `last_name` VARCHAR(45) NOT NULL ,
  `email` VARCHAR(50) NULL DEFAULT NULL ,
  `address_id` SMALLINT(5) UNSIGNED NOT NULL ,
  `active` TINYINT(1) NOT NULL DEFAULT TRUE ,
  `create_date` DATETIME NOT NULL ,
  `last_update` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ,
  PRIMARY KEY (`customer_id`) ,
  INDEX `idx_fk_store_id` (`store_id` ASC) ,
  INDEX `idx_fk_address_id` (`address_id` ASC) ,
  INDEX `idx_last_name` (`last_name` ASC) ,
  CONSTRAINT `fk_customer_address` FOREIGN KEY (`address_id` ) REFERENCES `sakila`.`address` (`address_id` ) ON DELETE RESTRICT ON UPDATE CASCADE,
  CONSTRAINT `fk_customer_store` FOREIGN KEY (`store_id` ) REFERENCES `sakila`.`store` (`store_id` ) ON DELETE RESTRICT ON UPDATE CASCADE)
ENGINE = InnoDB 
DEFAULT CHARACTER SET = utf8
COLLATE = latin1_swedish_ci

COMMENT = 'Table storing all customers. Holds foreign keys to the address table and the store table where this customer is registered.\n\nBasic information about the customer like first and last name are stored in the table itself. Same for the date the record was created and when the information was last updated.'

SQL脚本执行完成:语句:3个成功,1个失败

1 个答案:

答案 0 :(得分:0)

sakila-schema.sql对我来说很好。

如果删除此行,则create table语句应该有效:

COLLATE = latin1_swedish_ci