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:aufgaben:a02 [2024/10/17 13:41] – vdemir | modul:m290:learningunits:lu06:aufgaben:a02 [2024/11/20 14:36] (aktuell) – cbolzern | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ====== LU09.A02 - SQL- DCL: Grant Privileges - Under construction | + | ====== LU09.A02 - 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, | ||
| ===== Requirements | ===== Requirements | ||
| * Work type: individual | * Work type: individual | ||
| - | * Timeframe: | + | * Timeframe: |
| * Means of aid: | * Means of aid: | ||
| * only teaching materials, no websearch, no use of ai. | * only teaching materials, no websearch, no use of ai. | ||
| - | * [[https:// | + | * Webstorm with connection to the MySQL-DB |
| - | * Expected result: | + | * Expected result: |
| + | |||
| + | ===== 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 USER ' | ||
| + | |||
| + | ==== Task 2.2 ==== | ||
| + | ** Overview of the current privileges**: | ||
| + | |||
| + | SELECT user, host, plugin FROM mysql.user; | ||
| + | |||
| + | The result set should look like: | ||
| + | |||
| + | ==== Task 2.3 ==== | ||
| + | **Grant Privileges Without Table Management**: | ||
| + | |||
| + | GRANT SELECT, INSERT, UPDATE, DELETE ON myDatabase.* TO ' | ||
| + | |||
| + | ==== Task 2.4 ==== | ||
| + | **Revoke Privileges**: | ||
| + | |||
| + | REVOKE CREATE, ALTER, DROP ON myDatabase.* FROM ' | ||
| + | |||
| + | ==== Tasc 2.5 ==== | ||
| + | **View the User’s Privileges**: | ||
| + | |||
| + | SHOW GRANTS FOR ' | ||
| + | |||
| + | ==== Task 2.6 ==== | ||
| + | **Test the User’s Access**: Establish a new console connection to the database by using // | ||
| + | |||
| + | ==== Task 2.7 ==== | ||
| + | |||
| + | Finally, try to perform a CREATE TABLE or DROP TABLE operation. The attempt should result in a permission error as displayed in the image below. | ||
| - | .... | + | ==== Task 2.8 ==== |
| - | ===== Assignments ===== | + | **Delete the User (optional)**: |
| - | * a) ... | ||
| - | * | ||
| ===== Solution ===== | ===== Solution ===== | ||
| - | [[modul: | + | [[modul: |
| ===== Vocabulary ===== | ===== Vocabulary ===== | ||
| ^ English ^ German ^ | ^ English ^ German ^ | ||
| - | | respectively | + | | explicitely |
| | assignment | Auftrag | | | assignment | Auftrag | | ||
| + | | to revoke | widerrufen, aufheben | | ||
| ---- | ---- | ||
| [[https:// | [[https:// | ||