【问题标题】:MySQL: Unable to fulling forward engineering Sakila (sample) into serverMySQL:无法将 Sakila(示例)转发到服务器
【发布时间】:2011-07-12 09:14:09
【问题描述】:

下载 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 条失败

【问题讨论】:

    标签: sql mysql


    【解决方案1】:

    sakila-schema.sql 适合我。

    如果您删除此行,那么您的 create table 语句应该可以工作:

    COLLATE = latin1_swedish_ci
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-24
      • 2017-12-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多