-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexercise12
58 lines (34 loc) · 1.68 KB
/
exercise12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
12. DCL COMMAND
---------------
Create two users Spider, thor
mysql> create user Spider@'localhost' identified by '1234';
Query OK, 0 rows affected (0.00 sec)
mysql> create user thor@'localhost' identified by '1234';
Query OK, 0 rows affected (0.00 sec)
1. GRANT
Give insert and select privilege to Spider on customer table in the invoice database.
mysql> grant insert,select on INVOICE.CUSTOMER TO Spider@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW GRANTS FOR Spider@'localhost';
+----------------------------------------------------------------------+
| Grants for Spider@localhost |
+----------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'Spider'@'localhost' |
| GRANT SELECT, INSERT ON `INVOICE`.`CUSTOMER` TO 'Spider'@'localhost' |
+----------------------------------------------------------------------+
Give update and delete privilege to thor on all tables in the invoice database.
mysql> grant update,delete on INVOICE.* TO thor@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW GRANTS FOR thor@'localhost';
+-----------------------------------------------------------+
| Grants for thor@localhost |
+-----------------------------------------------------------+
| GRANT USAGE ON *.* TO 'thor'@'localhost' |
| GRANT UPDATE, DELETE ON `INVOICE`.* TO 'thor'@'localhost' |
+-----------------------------------------------------------+
2. REVOKE
Remove delete privilege of thor.
mysql> revoke delete on *.* from thor@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql>
//VERIFIED-CHECK CORRECTION