提交 5568288c 编写于 作者: M Mars Liu

user privileges

上级 a6c5bbe0
{
"node_id": "mysql-d32f7bece92e436ba0a0eefd0bc4a86c",
"keywords": [
"role",
"login",
"user",
"用户",
"角色",
"权限",
"privilege"
],
"children": [],
"export": [
"grant.json",
"revoke.json",
"role.json"
],
"keywords_must": [
["mysql", "用户"],
["mysql", "权限"]
],
"keywords_forbid": [],
"group": 1
}
\ No newline at end of file
......@@ -11,7 +11,10 @@
"auto_increment.json"
],
"keywords_must": [
["mysql", "表"]
[
"mysql",
"表"
]
],
"keywords_forbid": [],
"group": 1
......
......@@ -2,8 +2,10 @@
"node_id": "mysql-25808aa5b4ba4e78bd3dc59e09b403ed",
"keywords": [],
"children": [],
"export": [],
"export": [
"create_user.json"
],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
"group": 1
}
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "grant.md",
"source": "create_user.md",
"notebook_enable": false,
"exercise_id": "b64ebf99bff14f69b2ef92049bb7b57c"
}
\ No newline at end of file
# 创建用户
Joe 要给数据组的 John 创建一个用户,他希望John 能够从 `192.168.7.42` 登录 goods 数据库查询数据,
用户第一次登录时使用密码 `goods123`,登录后必须设定一个新密码,那么应该用哪个语句?
## 答案
```mysql
create user 'john'@'192.168.7.42' identified by 'goods123' password expire;
grant select on goods.* to 'john'@'192.168.7.42';
flush privileges;
```
## 选项
### A
```mysql
create user 'john'@'192.168.7.42' identified by 'goods123';
grant select on goods.* to 'john'@'192.168.7.42';
flush privileges;
```
### B
```mysql
create user 'john'@'192.168.7.42' identified by 'goods123';
grant usage on goods.* to 'john'@'192.168.7.42';
flush privileges;
```
### C
```mysql
create user 'john'@'192.168.7.42' identified by 'goods123' on database goods;
flush privileges;
```
\ No newline at end of file
{
"node_id": "mysql-1d0dd362995d4ee0b59e9e8d2e918d5f",
"keywords": [],
"children": [],
"export": [],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
}
\ No newline at end of file
{
"node_id": "mysql-8689980164b1428c865cf33ad889a088",
"keywords": [],
"children": [],
"export": [],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
}
\ No newline at end of file
......@@ -2,8 +2,11 @@
"node_id": "mysql-291ab4c99fa945ae8629b1956bc1ecc9",
"keywords": [],
"children": [],
"export": [],
"export": [
"grant.json",
"role.json"
],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
"group": 1
}
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "grant.md",
"notebook_enable": false,
"exercise_id": "ac5c6fee8d744ce18c6de9281c42eb16"
}
\ No newline at end of file
# 角色
Joe 现在是团队的 DBA,公司数据分析组有 Fred、Alice、James、Jone 四位成员,现在Joe需要给数据分析组授权,允许他们
查询 goods 数据库中的所有表,*规范*的操作应该是
查询 MySQL 8 服务器 goods 数据库中的所有表,*规范*的操作应该是
## 答案
......
......@@ -2,8 +2,10 @@
"node_id": "mysql-d2b788a8200140a693297356c02ce872",
"keywords": [],
"children": [],
"export": [],
"export": [
"view_privileges.json"
],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
"group": 1
}
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "view_privileges.md",
"notebook_enable": false,
"exercise_id": "ff524ab55f2b4160930e2b583476e7bf"
}
\ No newline at end of file
{
"node_id": "mysql-d47605d2cb134cdc98e6fbefc0651e8f",
"keywords": ["revoke"],
"keywords": [
"revoke"
],
"children": [],
"export": [],
"export": [
"revoke.json"
],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
"group": 1
}
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "change_password.md",
"notebook_enable": false,
"exercise_id": "92c30359eb7d4b538492a358b2f804b3"
}
\ No newline at end of file
# 修改口令
Fred 有一个 `'fred'@'%'` 账户,但是他忘了密码,需要 Joe 帮他修改一个新口令,
Joe 准备将这个口令初始化为 'goods123fred',并设置为登录后修改新口令。
Joe 应该怎么操作?
## 答案
```mysql
alter user 'fred'@'%' identified by 'goods123fred' password expire;
```
## 选项
### A
```mysql
alter user 'fred'@'%' identified by 'goods123fred';
```
### B
```mysql
alter user 'fred'@'%' set password 'goods123fred';
```
### C
```mysql
alter user 'fred'@'%' set password 'goods123fred' expire;
```
\ No newline at end of file
......@@ -2,8 +2,10 @@
"node_id": "mysql-12a66fd74a2741bbbfc0df7a59801123",
"keywords": [],
"children": [],
"export": [],
"export": [
"change_password.json"
],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
"group": 1
}
\ No newline at end of file
{
"node_id": "mysql-ae1794fcc925471cb8b1972cbfbf2951",
"keywords": [],
"children": [],
"export": [],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
}
\ No newline at end of file
......@@ -2,8 +2,10 @@
"node_id": "mysql-0bb8146d9ee54ff6934e45ce4e3b2f99",
"keywords": [],
"children": [],
"export": [],
"export": [
"drop_user.json"
],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
"group": 1
}
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "drop_user.md",
"notebook_enable": false,
"exercise_id": "407714aa87964c208cd12598bd5cc6c1"
}
\ No newline at end of file
# 删除用户
Jane 从公司离职,Joe 需要从数据库服务器删除她的账号 `'jane'@'%'` 。他应该怎么操作?
## 答案
```mysql
drop user 'jane'@'%';
```
## 选项
### A
```mysql
delete user 'jane'@'%';
```
### B
```mysql
remove user 'jane'@'%';
```
### C
```mysql
revoke user 'jane'@'%';
```
\ No newline at end of file
{
"node_id": "mysql-ab80d0d8af69427ab91a65b89de7e30c",
"keywords": ["resources", "limit"],
"keywords": [
"resources",
"limit"
],
"children": [],
"export": [],
"export": [
"limit_action.json"
],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
"group": 2
}
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "limit_action.md",
"notebook_enable": false,
"exercise_id": "7aabf9196dfa4a71bcff36b0f20a2cc4"
}
\ No newline at end of file
# 限制用户使用资源
Joe 需要限制数据分析组(role analysis)的用户, 每小时查询次数不能超过10000次。应该怎么操作?
## 答案
```mysql
alter user analysis with MAX_QUERIES_PER_HOUR 10000;
```
## 选项
### A
```mysql
set user analysis with MAX_QUERIES_PER_HOUR 10000;
```
### B
```mysql
alter role analysis with MAX_QUERIES_PER_HOUR 10000;
```
### C
```mysql
alter role analysis with MAX_QUERIES_PER_HOUR=10000;
```
### D
```mysql
alter user analysis set MAX_QUERIES_PER_HOUR 10000;
```
......@@ -568,33 +568,6 @@
"node_id": "mysql-eb03e9500ad143148847cd5130da4787",
"keywords": [],
"children": [
{
"用户和权限": {
"node_id": "mysql-d32f7bece92e436ba0a0eefd0bc4a86c",
"keywords": [
"role",
"login",
"user",
"用户",
"角色",
"权限",
"privilege"
],
"children": [],
"keywords_must": [
[
"mysql",
"用户"
],
[
"mysql",
"权限"
]
],
"keywords_forbid": [],
"group": 1
}
},
{
"表": {
"node_id": "mysql-0f0cd6ec82e343db95ed800a7d964cfc",
......@@ -1369,16 +1342,6 @@
"node_id": "mysql-c9ac9937371b403ebe252a9c48bc359e",
"keywords": [],
"children": [
{
"权限表": {
"node_id": "mysql-1d0dd362995d4ee0b59e9e8d2e918d5f",
"keywords": [],
"children": [],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
}
},
{
"创建普通用户": {
"node_id": "mysql-25808aa5b4ba4e78bd3dc59e09b403ed",
......@@ -1409,16 +1372,6 @@
"group": 0
}
},
{
"修改用户权限": {
"node_id": "mysql-ae1794fcc925471cb8b1972cbfbf2951",
"keywords": [],
"children": [],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
}
},
{
"撤销用户权限": {
"node_id": "mysql-d47605d2cb134cdc98e6fbefc0651e8f",
......@@ -1463,16 +1416,6 @@
"keywords_forbid": [],
"group": 0
}
},
{
"MySQL8的账户管理": {
"node_id": "mysql-8689980164b1428c865cf33ad889a088",
"keywords": [],
"children": [],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
}
}
],
"keywords_must": [],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册