
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get a List of MySQL User Accounts
To get the list of MySQL user accounts, we can use "SELECT USER".
The following is the query to display the list.
SELECT User FROM mysql.user;
Here is the output.
+------------------+ | User | +------------------+ | John | | Mac | | Manish | | mysql.infoschema | | mysql.session | | mysql.sys | | root | | am | +------------------+ 8 rows in set (0.00 sec)
The above output displays all the user accounts. Here is the query that gives corressponding host.
mysql> select User,Host from mysql.user;
The following is the output.
+------------------+-----------+ | User | Host | +------------------+-----------+ | John | % | | Mac | % | | Manish | % | | mysql.infoschema | % | | mysql.session | % | | mysql.sys | % | | root | % | | am | localhost | +------------------+-----------+ 8 rows in set (0.00 sec)
Advertisements