Rimuovere Utenti Dal SQL Server: differenze tra le versioni

Da ElettraWiki.
Nessun oggetto della modifica
Nessun oggetto della modifica
Riga 7: Riga 7:
Si procede per tanto come segue:
Si procede per tanto come segue:


Rimozione dei privilegi
Rimozione dei privilegi:


REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'editore'@'localhost'
<div id="atscreen">
Rimozione dell'utente
MariaDB [(none)]> SHOW GRANTS FOR 'iu6crh'@'%';                 
+-------------------------------------------------------------------------------------------------------+
| Grants for iu6crh@%                                                                                  |
+-------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'iu6crh'@'%' IDENTIFIED BY PASSWORD '*6DA413D8ACD33A112877D31A8BD9DDFB36411631' |
| GRANT ALL PRIVILEGES ON `hamlog`.* TO 'iu6crh'@'%'                                                   |
+-------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)


DROP USER 'editore'@'localhost'
MariaDB [(none)]> REVOKE ALL privileges ON hamlog.* FROM 'iu6crh'@'%';
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> SHOW GRANTS FOR 'iu6crh'@'%';                     
+-------------------------------------------------------------------------------------------------------+
| Grants for iu6crh@%                                                                                  |
+-------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'iu6crh'@'%' IDENTIFIED BY PASSWORD '*6DA413D8ACD33A112877D31A8BD9DDFB36411631' |
+-------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
 
MariaDB [(none)]>
</div>
 
Rimozione dell'utente:
 
<div id="atscreen">
MariaDB [(none)]> SELECT User, Host, Password, password_expired FROM mysql.user;
+--------+-----------+-------------------------------------------+------------------+
| User  | Host      | Password                                  | password_expired |
+--------+-----------+-------------------------------------------+------------------+
| root  | localhost |                                          | N                |
| iu6crh | %        | *6DA413D8ACD33A112877D31A8BD9DDFB36411631 | N                |
+--------+-----------+-------------------------------------------+------------------+
2 rows in set (0.00 sec)
 
MariaDB [(none)]> drop user iu6crh;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> SELECT User, Host, Password, password_expired FROM mysql.user;
+------+-----------+----------+------------------+
| User | Host      | Password | password_expired |
+------+-----------+----------+------------------+
| root | localhost |          | N                |
+------+-----------+----------+------------------+
1 row in set (0.00 sec)
 
MariaDB [(none)]>
</div>

Versione delle 21:46, 13 mag 2021

il comando DROP USER rimuove un utente dal SQL Server ma e' bene precisare che da solo esso non e' sufficiente in quanto il rimuovere l'utente non si concretizza con la contemporanea rimozione dei permessi ad esso correlati.

Si procede per tanto come segue:

Rimozione dei privilegi:

MariaDB [(none)]> SHOW GRANTS FOR 'iu6crh'@'%'; +-------------------------------------------------------------------------------------------------------+ | Grants for iu6crh@% | +-------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'iu6crh'@'%' IDENTIFIED BY PASSWORD '*6DA413D8ACD33A112877D31A8BD9DDFB36411631' | | GRANT ALL PRIVILEGES ON `hamlog`.* TO 'iu6crh'@'%' | +-------------------------------------------------------------------------------------------------------+ 2 rows in set (0.00 sec)

MariaDB [(none)]> REVOKE ALL privileges ON hamlog.* FROM 'iu6crh'@'%'; Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> SHOW GRANTS FOR 'iu6crh'@'%'; +-------------------------------------------------------------------------------------------------------+ | Grants for iu6crh@% | +-------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'iu6crh'@'%' IDENTIFIED BY PASSWORD '*6DA413D8ACD33A112877D31A8BD9DDFB36411631' | +-------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)

MariaDB [(none)]>

Rimozione dell'utente:

MariaDB [(none)]> SELECT User, Host, Password, password_expired FROM mysql.user; +--------+-----------+-------------------------------------------+------------------+ | User | Host | Password | password_expired | +--------+-----------+-------------------------------------------+------------------+ | root | localhost | | N | | iu6crh | % | *6DA413D8ACD33A112877D31A8BD9DDFB36411631 | N | +--------+-----------+-------------------------------------------+------------------+ 2 rows in set (0.00 sec)

MariaDB [(none)]> drop user iu6crh; Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> SELECT User, Host, Password, password_expired FROM mysql.user; +------+-----------+----------+------------------+ | User | Host | Password | password_expired | +------+-----------+----------+------------------+ | root | localhost | | N | +------+-----------+----------+------------------+ 1 row in set (0.00 sec)

MariaDB [(none)]>