MariaDB导入测试数据库employees

具体可参考:
http://dev.mysql.com/doc/empl...

1、下载sample database

mysql employees sample database下载链接
http://dev.mysql.com/doc/empl...
https://github.com/datacharme...
本地搬迁:
https://gitee.com/glc400/test...

2、解压安装包

$ unzip test_db-master.zip
$ cd test_db-master/

3、创建employee用户

$ sudo mysql
MariaDB [(none)]> CREATE USER 'employee'@'%' IDENTIFIED BY 'employee';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> QUIT;
Bye

4、调整数据库引擎

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、开始导入数据

$ sudo mysql -t < employees.sql

或者使用管理员账户导入:

$ sudo mysql -u admin -p -t < employees.sql

6、查看验证导入的数据

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、授权

$ sudo mysql
MariaDB [(none)]> GRANT ALL ON employees.* TO employee;
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> QUIT;
Bye

8、测试权限

$ sudo mysql -u employee -p
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| employees          |
| information_schema |
+--------------------+
2 rows in set (0.000 sec)

其他

Employee测试数据库语句:
https://segmentfault.com/a/11...

你可能感兴趣的