数据库系统实验 2 实验报告
数据科学与计算机学院 计算机科学与技术 2016 级
王凯祺 16337233
2018 年 10 月 15 日
1 实验 2.1 自主存取控制实验
1.1 创建用户
创建用户 Amit, Satoshi 。
1 create user ’Amit’@’%’ with mysql_native_password identified by ’123456’;
2 create user ’Satoshi’@’%’ with mysql_native_password identified by ’123456’;
我曾尝试过使用
1 insert into mysql.user (host, user, password) values (’%’, ’Amit’, password(’123456’
));
来添加用户,可是 mysql 总是在 password 处报错,提示 Error Code: 1064. You have an error
in your SQL syntax; check the manual that corresponds to your MySQL server version for the right
syntax to use near ’(’123456’))’ at line 1 。我上网查找了这个错误,发现是由于 Mysql 8.0 删除了
password 函数,遂改用 create user 语句来添加用户。
参考地址:https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_password
1.2 创建角色并分配权限
1.2.1 创建角色 instructor
1
create role
instructor;
1.2.2 为 instructor 角色分配权限
为 instructor 角色在 takes 表中授予 select 权限。
1 grant select on lab.takes to instructor;
1
评论0