导入mysql示例数据库employees

练习mysql的语法,同样可以使用employees数据库,https://launchpad.net/test-db/employees-db-1/1.0.6 ,下载后导入数据库,但在执行如下命令时分别碰到如下错误,该如何处理呢?

问题1:
myhost:/home/employees/employees_db # mysql -t -uroot -pxxxxxxx < employees.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
+-----------------------------+
| INFO                        |
+-----------------------------+
| CREATING DATABASE STRUCTURE |
+-----------------------------+
ERROR 1193 (HY000) at line 38: Unknown system variable 'storage_engine'
 

解决方法:由于mysql5.7.5以后,storage_engine这个变量被移除了,employees.sql 改用default_storage_engine就可以了,清理包括如下两个地方,大家晚一点。

myhost:/home/employees/employees_db # vi employees.sql 

   set default_storage_engine = InnoDB;
-- set storage_engine = MyISAM;
-- set storage_engine = Falcon;
-- set storage_engine = PBXT;
-- set storage_engine = Maria;

select CONCAT('storage engine: ', @@default_storage_engine) as INFO;

CREATE TABLE employees (
    emp_no      INT             NOT NULL,
    birth_date  DATE            NOT NULL,
    first_name  VARCHAR(14)     NOT NULL,
    last_name   VARCHAR(16)     NOT NULL,
    gender      ENUM ('M','F')  NOT NULL,
    hire_date   DATE            NOT NULL,
    PRIMARY KEY (emp_no)
);

myhost:/home/employees/employees_db # service mysqld status

执行导入成功

myhost:/home/employees/employees_db # mysql -t -uroot -pxxxxxxxx < employees.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
+-----------------------------+
| INFO                        |
+-----------------------------+
| CREATING DATABASE STRUCTURE |
+-----------------------------+
+------------------------+
| INFO                   |
+------------------------+
| storage engine: InnoDB |
+------------------------+
+---------------------+
| INFO                |
+---------------------+
| LOADING departments |
+---------------------+
+-------------------+
| INFO              |
+-------------------+
| LOADING employees |
+-------------------+
+------------------+
| INFO             |
+------------------+
| LOADING dept_emp |
+------------------+
+----------------------+
| INFO                 |
+----------------------+
| LOADING dept_manager |
+----------------------+
+----------------+
| INFO           |
+----------------+
| LOADING titles |
+----------------+
+------------------+
| INFO             |
+------------------+
| LOADING salaries |
+------------------+
 

 

你可能感兴趣的:(导入mysql示例数据库employees)