Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
How to get a list of MySQL user hosts?
Firstly, get a list of MySQL user accounts, using MySQL.user table. You can use select user column from MySQL.user table to get a list of MySQL user accounts.
The query is as follows −
mysql> select user from MySQL.user;
The following output displays all the users −
+------------------+ | user | +------------------+ | Manish | | mysql.infoschema | | mysql.session | | mysql.sys | | root | | am | +------------------+ 6 rows in set (0.06 sec)
Now you can get a list of host from MySQL.user table. There is host column present in MySQL.user table.
The query is as follows −
mysql> select user,host from MySQL.user;
The following output displays users and host −
+------------------+-----------+ | user | host | +------------------+-----------+ | Manish | % | | mysql.infoschema | % | | mysql.session | % | | mysql.sys | % | | root | % | | am | localhost | +------------------+-----------+ 6 rows in set (0.00 sec)
Advertisements
