xxxxxxxxxx
select * from mysql.user;
#or for less data
select user, host from mysql.user;
xxxxxxxxxx
SELECT * FROM mysql.user;
SELECT * FROM information_schema.user_privileges;
SELECT CONCAT('SHOW GRANTS FOR ''',user,'''@''',host,''';') FROM mysql.user;
SHOW GRANTS FOR 'my_user'@'localhost';
xxxxxxxxxx
//To show all data use following query
select * from mysql.user;
// To show user and host use following query
select User,Host from mysql.user;
xxxxxxxxxx
#display all user data
select * from mysql.user;
#display username and host
select user, host from mysql.user;
xxxxxxxxxx
mysql> select user,host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| admin | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
xxxxxxxxxx
// login to mysql as root
mysql -u root -p
// use mysql database
use mysql;
// list users
select user,host from user;
xxxxxxxxxx
sudo mysql # first run this command to login mysql
select user, host from mysql.user;