1. 程式人生 > 其它 >Linux-MySQL示例資料庫employees的匯入操作

Linux-MySQL示例資料庫employees的匯入操作

1. 下載employees示例資料庫
employees是一個官方提供的簡單資料庫,在mysql的官方找到employees的說明頁面,通過github下載該資料庫。

https://github.com/datacharmer/test_db

2. 匯入employees資料庫
解壓下載好的打包檔案,切換到解壓後的目錄中。

unzip  test_db_master.zip

tree test_db-master/

test_db-master/
├── Changelog
├── employees_partitioned_5.1.sql
├── employees_partitioned.sql
├── employees.sql
├── images
│ ├── employees.gif
│ ├── employees.jpg
│ └── employees.png
├── load_departments.dump
├── load_dept_emp.dump
├── load_dept_manager.dump
├── load_employees.dump
├── load_salaries1.dump
├── load_salaries2.dump
├── load_salaries3.dump
├── load_titles.dump
├── objects.sql
├── README.md
├── sakila
│ ├── README.md
│ ├── sakila-mv-data.sql
│ └── sakila-mv-schema.sql
├── show_elapsed.sql
├── sql_test.sh
├── test_employees_md5.sql
└── test_employees_sha.sql

cd  test_db_master/

employees資料庫能夠適配不同的儲存引擎,預設使用InnoDB,編輯employees.sql可以修改註釋選擇不同的儲存引擎。

使用mysql命令匯入employees

mysql -uroot -pxxxxxx -t < employees.sql

校驗匯入的employees資料,能夠使用md5或sha進行校驗

mysql -uroot -pxxxxxx -t < test_employees_sha.sql 

mysql
-uroot -pxxxxxx -t < test_employees_md5.sql

3. employees的表結構