MySql安装自带的测试数据库Employees

         今天群里有个朋友想要弄点测试数据集,自己平时做做练习。接下来咱们搞起来。

         MySQL有自带的数据库employees,容易安装,方面我们平时做测试或者自学使用。

目录

MySql安装自带的测试数据库Employees

Windows安装版本

 Linux安装版本

Windows安装版本


下载地址:https://launchpad.net/test-db/+download

官网https://dev.mysql.com/doc/employee/en/employees-installation.html 

1)先解压缩文件,可以右键解压缩,也可以命令解压缩,我是用电脑右键WinRAR; 

2)官网是要设置The Employees database is compatible with several different storage engines, with the InnoDB engine enabled by default. Edit the employee.sql file and adjust the comments to choose a different storage engine: 

但是我发现我的employees.sql文件跟官网一样的如下 

set storage_engine = InnoDB; 

– set storage_engine = MyISAM; 

– set storage_engine = Falcon; 

– set storage_engine = PBXT; 

– set storage_engine = Maria; 

但是还会报错ERROR 1193 (HY000) at line 38: Unknown system variable ‘storage_engine’ 

查找原因是默认就是InnoDB,所以索性注释掉38-44行 

– set 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; 

 

3)导入我的这个测试数据放在了F:\DB\employees_db-full-1.0.6\employees_db目录下,那么就要在此目录下进行命令行操作 
进入命令窗口 

 Linux安装版本

1.测试库下载:https://github.com/datacharmer/test_db

2.解压test_db-master.zip 

3.输入该命令,导入employees.sql文件

mysql -u root -p < employees.sql

 4.验证是否成功 

mysql -u root -p < test_employees_md5.sql

 

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
table_name  found_records       found_crc
employees   300024  4ec56ab5ba37218d187cf6ab09ce1aa1
departments 9   d1af5e170d2d1591d776d5638d71fc5f
dept_manager    24  8720e2f0853ac9096b689c14664f847e
dept_emp    331603  ccf6fe516f990bdaa49713fc478701b7
titles  443308  bfa016c472df68e70a03facafa1bc0a8
salaries    2844047 fd220654e95aea1b169624ffe3fca934
table_name  records_match   crc_match
employees   OK  ok
departments OK  ok
dept_manager    OK  ok
dept_emp    OK  ok
titles  OK  ok
salaries    OK  ok
computation_time
00:00:13
summary result
CRC OK
count   OK

则导入成功。

若将数据导入mysql 5.7.17的时候报错如下:

ERROR 1193 (HY000) at line 38: Unknown system variable 'storage_engine'

修复以下内容就行了:
由原来的“storage_engine”改成“default_storage_engine”,如下:

下载测试库

安装导入数据

        保存,再执行导入就正常了:

关注Excel螺丝钉,回复Mysql测试库,获取安装包

mysql示例数据库 employee,这个大家也可以到github官网下载。 https://github.com/datacharmer/test_db test_db A sample database with an integrated test suite, used to test your applications and database servers This repository was migrated from Launchpad. See usage in the MySQL docs Where it comes from The original data was created by Fusheng Wang and Carlo Zaniolo at Siemens Corporate Research. The data is in XML format. http://timecenter.cs.aau.dk/software.htm Giuseppe Maxia made the relational schema and Patrick Crews exported the data in relational format. The database contains about 300,000 employee records with 2.8 million salary entries. The export data is 167 MB, which is not huge, but heavy enough to be non-trivial for testing. The data was generated, and as such there are inconsistencies and subtle problems. Rather than removing them, we decided to leave the contents untouched, and use these issues as data cleaning exercises. Prerequisites You need a MySQL database server (5.0+) and run the commands below through a user that has the following privileges: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW Installation: Download the repository Change directory to the repository Then run mysql < employees.sql If you want to install with two large partitioned tables, run mysql < employees_partitioned.sql Testing the installation After installing, you can run one of the following mysql -t < test_employees_md5.sql # OR mysql -t < test_employees_sha.sql For example: mysql -t < test_employees_md5.sql +----------------------+ | INFO | +----------------------+ | TESTING INSTALLATION | +----------------------+ +--------------+------------------+----------------------------------+ | table_name | expected_records | expected_crc | +--------------+------------------+----------------------------------+ | employees | 300024 |
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值