find users on mysql

How To Check Users in MySQL Server

how to check users, If you are not aware of how many users are on your MySQL server. So you can check it via command in MySQL. The local user and MySQL user are totally different from each other. The local user on server will be able to login to server but not on the MySQL Server.

Check Out : Recover Root Password Of Mysql Server

If you need to login MySQL server with a user, So you will have to create it in MySQL server.

I have created a database “ testing “

create database testing;

Created a user testwithpassword

CREATE USER ‘test’@’’ IDENTIFIED BY “password”;

Check Out : Mysql Error “Too Many Connections”

Now you can see how many users are there. I created one more user ‘ aryan’ with ‘ passwordaryan

select user from mysql.user;

if you want to avoid repetitions of users when they connect from different origin.

select distinct user from mysql.user;

if you want to see the user with their IP address, run the below commands.

select user,host from mysql.user;

Check Out : Mysql Error “Access denied for user ‘user’@’localhost’ (using password: YES) “

You can also paste all the user in a text file using below command

mysql -e ‘ select user,host from mysql.user ‘ > userDatabase.txt

if you password on MySQL server, you below command

mysql -u root -p -e ‘ select user,host from mysql.user ‘ > userDatabase.txt

You’re done

Leave a Reply

Notify of