For details, please refer to:
http://dev.mysql.com/doc/employee/en/employees-installation.html
1. Download the sample database
mysql employees sample database download link
http://dev.mysql.com/doc/employee/en/index.html
https://github.com/datacharmer/test_db
local relocation:
https://gitee.com/glc400/test_db/tree/master
2. Unzip the installation package
$ unzip test_db-master.zip
$ cd test_db-master/
3. Create employee user
$ sudo mysql
MariaDB [(none)]> CREATE USER 'employee'@'%' IDENTIFIED BY 'employee';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> QUIT;
Bye
4. Adjust the database engine
The Employees database is compatible with all storage engines. You must edit the employee.sql and comment out the storage engine that you want to use:
set storage_engine = InnoDB;
-- set storage_engine = MyISAM;
-- set storage_engine = Falcon;
-- set storage_engine = PBXT;
-- set storage_engine = Maria;
5. Start importing data
$ sudo mysql -t < employees.sql
Or use the administrator account to import:
$ sudo mysql -u admin -p -t < employees.sql
6. View and verify the imported data
You can validate the Employee data using two methods, md5 and sha. Two SQL scripts are provided for this purpose, test_employees_sha.sql and test_employees_md5.sql. To run the tests, use mysql:
$ sudo time mysql -t < test_employees_sha.sql
$ sudo time mysql -t < test_employees_md5.sql
7. Authorization
$ sudo mysql
MariaDB [(none)]> GRANT ALL ON employees.* TO employee;
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> QUIT;
Bye
8. Test permissions
$ sudo mysql -u employee -p
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| employees |
| information_schema |
+--------------------+
2 rows in set (0.000 sec)
other
Employee test database statement:
https://segmentfault.com/a/1190000040672007
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。