MySQL安装employee数据库,报Unknown system variable 'storage_engine'错误

(1)下载文件 employees_db-full-1.0.6.tar.bz2
(2)通过xshell rz方式上传文件,通过以下命令解压
tar jxf employees_db-full-1.0.6.tar.bz2

(3)安装employee数据库

[root@localhost employees_db]# mysql -uroot -S /tmp/mysql.sock -p < employees.sql 
Enter password: 
INFO
CREATING DATABASE STRUCTURE
ERROR 1193 (HY000) at line 38: Unknown system variable 'storage_engine'

解决方法:

[root@localhost employees_db]# vim  employees.sql
DROP DATABASE IF EXISTS employees;
CREATE DATABASE IF NOT EXISTS employees;
USE employees;

SELECT 'CREATING DATABASE STRUCTURE' as 'INFO';

DROP TABLE IF EXISTS dept_emp,
                     dept_manager,
                     titles,
                     salaries,
                     employees,
                     departments;

set storage_engine = InnoDB;----修改为:   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: ', @@storage_engine) as INFO;----修改为:select CONCAT('storage engine: ', @@default_storage_engine) as INFO;必须把原内容删除才生效
 重新导入成功
 

[root@localhost employees_db]# mysql -uroot -p -t < employees.sql
Enter password: 
+-----------------------------+
| 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 |
+------------------+
(4)验证:同样需要将文件中的engine修改,并删除SET storage_engine=MyISAM;不然会报错
[root@localhost employees_db]# time mysql -uroot -S /tmp/mysql.sock -p -t < test_employees_sha.sql 
Enter password: 
+----------------------+
| INFO                 |
+----------------------+
| TESTING INSTALLATION |
+----------------------+
ERROR 1193 (HY000) at line 28: Unknown system variable 'storage_engine'

real    0m1.799s
user    0m0.002s
sys    0m0.004s
 再次执行:
 [root@localhost employees_db]# time mysql -uroot -S /tmp/mysql.sock -p -t < test_employees_sha.sql 
Enter password: 
+----------------------+
| INFO                 |
+----------------------+
| TESTING INSTALLATION |
+----------------------+
+--------------+------------------+------------------------------------------+
| table_name   | expected_records | expected_crc                             |
+--------------+------------------+------------------------------------------+
| employees    |           300024 | 4d4aa689914d8fd41db7e45c2168e7dcb9697359 |
| departments  |                9 | 4b315afa0e35ca6649df897b958345bcb3d2b764 |
| dept_manager |               24 | 9687a7d6f93ca8847388a42a6d8d93982a841c6c |
| dept_emp     |           331603 | d95ab9fe07df0865f592574b3b33b9c741d9fd1b |
| titles       |           443308 | d12d5f746b88f07e69b9e36675b6067abb01b60e |
| salaries     |          2844047 | b5a1785c27d75e33a4173aaa22ccf41ebd7d4a9f |
+--------------+------------------+------------------------------------------+
同样也需要修改engine
[root@localhost employees_db]# time mysql -uroot -S /tmp/mysql.sock -p -t < test_employees_md5.sql 
Enter password: 
+----------------------+
| INFO                 |
+----------------------+
| TESTING INSTALLATION |
+----------------------+
+--------------+------------------+----------------------------------+
| table_name   | expected_records | expected_crc                     |
+--------------+------------------+----------------------------------+
| employees    |           300024 | 4ec56ab5ba37218d187cf6ab09ce1aa1 |
| departments  |                9 | d1af5e170d2d1591d776d5638d71fc5f |
| dept_manager |               24 | 8720e2f0853ac9096b689c14664f847e |
| dept_emp     |           331603 | ccf6fe516f990bdaa49713fc478701b7 |
| titles       |           443308 | bfa016c472df68e70a03facafa1bc0a8 |
| salaries     |          2844047 | fd220654e95aea1b169624ffe3fca934 |
+--------------+------------------+----------------------------------+

 

你可能感兴趣的:(Mysql)