Die Aufgabe ist es Informationen über User, ihre Berechtigungen und deren Zugriff auf Datenbanken herauszubekommen.
SHOW GRANTS FOR 'root'@'localhost';
SHOW GRANTS;
SHOW GRANTS FOR CURRENT_USER;
SHOW GRANTS FOR CURRENT_USER();User auflisten
SELECT User FROM mysql.global_priv;
+-------------+
| User |
+-------------+
| PUBLIC |
| mariadb.sys |
| mysql |
| root |
+-------------+
SELECT GRANTEE
FROM INFORMATION_SCHEMA.USER_PRIVILEGES
GROUP BY GRANTEE;
+---------------------------+
| GRANTEE |
+---------------------------+
| 'mariadb.sys'@'localhost' |
| 'mysql'@'localhost' |
| 'root'@'localhost' |
+---------------------------+
User und Hosts
SELECT User,Host FROM mysql.user GROUP BY User,Host;
+-------------+-----------+
| User | Host |
+-------------+-----------+
| PUBLIC | |
| mariadb.sys | localhost |
| mysql | localhost |
| root | localhost |
+-------------+-----------+
Datenbanken
select User,Host from mysql.db where db='test' group by User,Host;
# Das Ergebnis ist leer, da meine Tabelle keine Daten enthält;
Tags