具体可参考:
http://dev.mysql.com/doc/employee/en/employees-installation.html
1.下载sample database
mysql employees sample database 下载链接
http://dev.mysql.com/doc/employee/en/index.html
2.创建用户
mysql> create user 'employee'@'localhost' identified by 'employee'; Query OK, 0 rows affected (0.00 sec) mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed
3.解压安装包
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;
4.开始导入数据
$ mysql -t < employees.sql --这里需要用户来运行即:
$ mysql -uroot -p -t < employees.sql
5.查看验证导入的数据
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:
$ time mysql -t < test_employees_sha.sql
$ time mysql -t < test_employees_md5.sql
6.授权
mysql> grant all on employees.* to employee; Query OK, 0 rows affected (0.00 sec)
7.测试权限
# mysql -u employee -p