How to check the MySQL user name (check the user name of mysql)

How to check the MySQL user name (check the user name of mysql)

MySQL is one of the most popular relational databases, and it is probably one of the most commonly used databases for developing web applications and other network applications. Once the user creates their login details in MySQL, they need to view the MySQL username in order to log in to the database with the correct credentials. So, is there any way to check the MySQL username?

## 1.MySQL command

Under the MySQL response window, we can use the following command to view the MySQL user name:

`SELECT User FROM mysql.user;`

The above command will display all MySQL usernames present in the current database server.

## 2.MySQL management tools

The above commands can also be executed through the MySQL management tool. These MySQL management tools, such as phpMyAdmin, HeidiSQL, etc., can view usernames.

Some management tools allow users to view MySQL usernames in the "MySQL Users" tab. For example, using phpMyAdmin, you can view the MySQL username in the "MySQL Users" pane, as shown below:

![phpMyAdmin](http://webclassmodel.com/wp-content/uploads/2017/08/phpmyadmin_mySQL_user.jpg)

## 3.MySQL SQL statement

Additionally, MySQL users also can use the SQL statement to view the username. Here is a sample SQL statement to view the MySQL username:

`SELECT user_name FROM mysql.user;`

## Summarize

Through this article, we have mastered how to view the MySQL user name through MySQL commands, MySQL management tools and MySQL SQL statements. This way, users can interact with the MySQL database more easily and obtain more information. How to check the MySQL user name (check the user name of mysql) - database remote operation and maintenance

Guess you like

Origin blog.csdn.net/thanklife/article/details/131938043