Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| modul:m290:learningunits:lu06:loesungen:l02 [2024/10/29 12:32] – vdemir | modul:m290:learningunits:lu06:loesungen:l02 [2024/11/13 16:43] (aktuell) – cbolzern | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ====== LU09.A02 - SQL- DCL: CREATE USER ====== | + | ====== LU09.S02 - SQL- DCL: CREATE USER ====== |
| - | It is high time to mess a litte around with our new SQL powers, don't you think? So, let's try it directly on our Webstorm. | + | |
| - | As the database administrator, | + | ===== Task 2.1 ===== |
| - | + | ||
| - | ===== Requirements | + | |
| - | * Work type: individual | + | |
| - | * Timeframe: 10 Minutes | + | |
| - | * Means of aid: | + | |
| - | * only teaching materials, no websearch, no use of ai. | + | |
| - | * Webstorm with connection to the MySQL-DB | + | |
| - | * Expected result: Semantically and syntactically correct SQL statements according to the requirements of the case studies. | + | |
| - | + | ||
| - | ===== Case studies / Assignments ===== | + | |
| - | As a database administrators we are assigned to create a AppUser, which has for security reasons only the right for DML operations, but must not be allowed for DDL operation. We don't want a hacker to delete our entire webshop, do we? | + | |
| - | + | ||
| - | To get the job done, follow the instructions below: | + | |
| - | + | ||
| - | - Create as the sysdba (systemadministrator of the databaswe) a new user | + | |
| - | - Grant this role only the necessary rights | + | |
| - | - Create as a sysdba a test table and fill it with some testdata | + | |
| - | - Establish a new connection within the webstorm by using the credentials of this new user | + | |
| - | - Try out the DML operations, wich should be possible (insert, update, delete) | + | |
| - | - Try out to DDL operations, which should result in errors due to missing permissions for that particular user | + | |
| - | - Drop the newly created user finally | + | |
| - | + | ||
| - | ==== Task 2.1 ==== | + | |
| **Create the User**: Create a user named // | **Create the User**: Create a user named // | ||
| CREATE USER ' | CREATE USER ' | ||
| - | ==== Task 2.2 ==== | + | ===== Task 2.2 ===== |
| ** Overview of the current privileges**: | ** Overview of the current privileges**: | ||
| Zeile 39: | Zeile 15: | ||
| {{: | {{: | ||
| - | ==== Task 2.3 ==== | + | ===== Task 2.3 ===== |
| **Grant Privileges Without Table Management**: | **Grant Privileges Without Table Management**: | ||
| GRANT SELECT, INSERT, UPDATE, DELETE ON myDatabase.* TO ' | GRANT SELECT, INSERT, UPDATE, DELETE ON myDatabase.* TO ' | ||
| - | ==== Task 2.4 ==== | + | ===== Task 2.4 ===== |
| - | **Rovoke | + | **Revoke |
| REVOKE CREATE, ALTER, DROP ON myDatabase.* FROM ' | REVOKE CREATE, ALTER, DROP ON myDatabase.* FROM ' | ||
| - | ==== Tasc 2.5 ==== | + | ===== Tasc 2.5 ===== |
| **View the User’s Privileges**: | **View the User’s Privileges**: | ||
| Zeile 56: | Zeile 32: | ||
| {{: | {{: | ||
| - | ==== Task 2.6 ==== | + | ===== Task 2.6 ===== |
| **Test the User’s Access**: Establish a new console connection to the database by using // | **Test the User’s Access**: Establish a new console connection to the database by using // | ||
| {{: | {{: | ||
| - | ==== Task 2.7 ==== | + | ===== Task 2.7 ==== |
| Finally, try to perform a CREATE TABLE or DROP TABLE operation. The attempt should result in a permission error als displayed in the image below. | Finally, try to perform a CREATE TABLE or DROP TABLE operation. The attempt should result in a permission error als displayed in the image below. | ||
| Zeile 68: | Zeile 44: | ||
| - | ==== Task 2.8 ==== | + | ===== Task 2.8 ===== |
| **Delete the User (optional)**: | **Delete the User (optional)**: | ||