Mysql 使用测试样例数据

2020年11月14日 18点热度 0人点赞 0条评论

mysql官方提供了一套员工样例数据employees sample data,大约有160MB,6张表,包含超过400万条数据。不同的数据类型,官方还同时提供了表的关联关系。方便我们做测试使用。

employees是mysql官方提供的测试库下载:https://github.com/datacharmer/test_db

前期准备:

  • 设置mysql的环境变量(如果已经添加可以忽略)

mysql程序位于MySQL安装文件夹的目录bin下

C:\Program Files\MySQL\MySQL Server 8.0\bin
  • 登录mysql
mysql -u root -p

Enter password: ********

您需要输入root用户帐户的密码才能登录。

安装步骤:

 

  1. 解压test_db-master.zip

  2. 进入 test_db-master 目录

cd test_db-master
  1. 导入数据库
mysql -t < employees.sql
  1. 验证数据
time mysql -t < test_employees_sha.sql
+----------------------+
| INFO |
+----------------------+
| TESTING INSTALLATION |
+----------------------+
+--------------+------------------+------------------------------------------+
| table_name | expected_records | expected_crc |
+--------------+------------------+------------------------------------------+
| employees | 300024 | 4d4aa689914d8fd41db7e45c2168e7dcb9697359 |
| departments | 9 | 4b315afa0e35ca6649df897b958345bcb3d2b764 |
| dept_manager | 24 | 9687a7d6f93ca8847388a42a6d8d93982a841c6c |
| dept_emp | 331603 | f16f6ce609d032d6b1b34748421e9195c5083da8 |
| titles | 443308 | d12d5f746b88f07e69b9e36675b6067abb01b60e |
| salaries | 2844047 | b5a1785c27d75e33a4173aaa22ccf41ebd7d4a9f |
+--------------+------------------+------------------------------------------+
+--------------+------------------+------------------------------------------+
| table_name | found_records | found_crc |
+--------------+------------------+------------------------------------------+
| employees | 300024 | 4d4aa689914d8fd41db7e45c2168e7dcb9697359 |
| departments | 9 | 4b315afa0e35ca6649df897b958345bcb3d2b764 |
| dept_manager | 24 | 9687a7d6f93ca8847388a42a6d8d93982a841c6c |
| dept_emp | 331603 | f16f6ce609d032d6b1b34748421e9195c5083da8 |
| titles | 443308 | d12d5f746b88f07e69b9e36675b6067abb01b60e |
| salaries | 2844047 | b5a1785c27d75e33a4173aaa22ccf41ebd7d4a9f |
+--------------+------------------+------------------------------------------+
+--------------+---------------+-----------+
| 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 |
+--------------+---------------+-----------+

数据库关系图

[DPUIVH.png

KOgoal

文章评论