Rimuovere Utenti Dal SQL Server
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)]>