-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQustion.txt
More file actions
124 lines (91 loc) · 5.23 KB
/
Copy pathQustion.txt
File metadata and controls
124 lines (91 loc) · 5.23 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
Ex :
login in to Root user account in XAMPP and do the followings steps.
(i) Create user account with user name : staff01 , host : localhost with password : 123
(ii) Check whether staff01 user account is Created or not in the root user account.
(iii) login to that user staff01 and try to create the database. (petsDB database there)
(iv) Again login to Root user and Show the Grants for staff01 user account.
(v) Select * from user.
Privilliages : Create, Insert, Select , Update , DELETE
/*
Grant
-database
-table
-column
*/
Common :
GRANT [privileges] on [Database name].[Tables] to [username@hostname]
1. Give Access to Database (All the tables)
GRANT [privileges] on [Database name].* to [username@hostname]
A. Create
( Create Table Access for Particular Database )
(i) Create the Database with name PetsDB in root user account
(ii) Check whether that database is Created or not
(iii)use that database
(iv) grant the Create privilege for cretaing the all new Tables in that PetsDB Database through staff01 User Account.
(v) Show the Grants for staff01 user account. after that exit from root account.
(vi) login to staff01 account.
(vi) check the databases on that staff01account.
(vii) use that database on that staff01 Account.
(viii) Create the Table 01: Owner in the Practical Exercise - 02 PDF with proper indication of Primary Key.
(ix) Check whether that table is Created or not
(x) Display the data definition for this table.
Exit from staff01 user account and login into root user account now.
Through this Create privileges , We can Able to create Any number of Tables with in the PetsDB database
by using Staff01 User account.
B. SELECT
( SELECT Access for Each tables in the Particular Database )
(i) grant the Select privilege for all Tables in that PetsDB Database through staff01 User Account.
(ii) Refresh your privilege.
(iii) exit from root user and login to staff01 user account.
(iv) Display the data definition for this table.
(v) Select the all values from table.
(vi) Try Insert the Values into the Owner Table.
(vii) Exit from staff01 user account and login into root user account now.
Through this Select privileges , We can Able to Select All the Tables with in the PetsDB database
by using Staff01 User account and view the data definition for each Tables.
C.INSERT
( INSERT Values into the Tables in the Particular Database )
(i) grant the Insert privilege for all Tables in that PetsDB Database through staff01 User Account.
(ii) Refresh your privilege.
(iii) exit from root user and login to staff01 user account.
(iv) Insert all the Values into the Owner Table.
(v) display all the values from Owner Table.
(vi) try to update the value : Update the Town as “Omanthai” for whose OwnerId is 2323.
(vii) Exit from staff01 user account and login into root user account now.
Through this INSERT privileges , We can Able to Insert all the values for All the Tables with in
the PetsDB database by using Staff01 User account.
D.Update
( Update Values into the Tables in the Particular Database )
(i) grant the Update privilege for all Tables in that PetsDB Database through staff01 User Account.
(ii) Refresh your privilege.
(iii) exit from root user and login to staff01 user account.
(iv) Update the Values into the Owner Table: Update the Town as “Omanthai” for whose OwnerId is 2323.
(v) display all the values from Owner Table check whether that value is updated or not.
(vi) Try to delete the record which has ownerId as 2312
(vii) Exit from staff01 user account and login into root user account now.
Through this Update privileges , We can Able to Update all the values for All the Tables with in
the PetsDB database by using Staff01 User account.
E. DELETE
( DELETE Record from the Tables in the Particular Database)
(i) grant the delete privilege for all Tables in that PetsDB Database through staff01 User Account.
(ii) Refresh your privilege.
(iii) exit from root user and login to staff01 user account.
(iv) DELETE the Value from the Owner Table: Delete the record from owner table which has OwnerId is 2312.
(v) display all the values from Owner Table check whether that value is deleted or not.
Through this Delete privileges , We can Able to delete the record from Table with in
the PetsDB database by using Staff01 User account.
Ex02 :
Create the Table 02 : Pets in the Practical Exercise - 02 PDF with proper indication of Primary Key
in the staff01 user account using PetsDB database.
Insert the Values in to the Pets Table.
Update the Petname as Browny for the PetId = 113
Delete the record from Pets Table where PetId = 112
Now Try to Drop the PetsDB database inside the Staff01 User account.
Exit from staff01 user account and login into root user account now.
F. DROP
( DROP Particular Database)
(i) grant the delete privilege for PetsDB Database through staff01 User Account.
(ii) Refresh your privilege.
(iii) exit from root user and login to staff01 user account.
(iv) Drop the PetsDB database from staff01 user account .
(v) check whether that database is deleted or not.