![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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