How To List MySQL Database Users?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/list-mysql-database-users/
PINTEREST
PINTEREST
INSTAGRAM

MySQL database server have users to connect and use databases and tables. Users provides security for database operations. MySQL server comes with default users or in the operations a lot of users are created. In this post we will look how to list these users.

Connect To Database

We will connect to the MySQL database server to list user. MySQL is a tool used to manage databases, tables, users and other parts of the database.

Connect To Database

Connect To Database

List Users From User Table

User information is stored in database named mysql which is used for internal MySQL Database operations. User table holds all the database about users. We will use following SELECT query to get only user named with user  column.

List Users From User Table

List Users From User Table

Get Detailed User Information

As we see there is 3 user those are created by default. We have only listed usernames. We can get other information about users like below. We will use SELECT query and list all information about users. But this will print information in messy format as we can see below.

Get Detailed User Information

Get Detailed User Information

Get User Host Restrictions

Users for MySQL have some restriction to connect MySQL server. Host column of user table hold which user can connect from which host. We can see host information like below.

Get User Host Restrictions

Get User Host Restrictions

In the screenshot our MySQL server only accepts connection from localhost or all users.

LEARN MORE  How To Connect MySQL Database From Python Application and Execute Sql Query with Examples

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)