How To Check Users In Mysql Database Server On Linux

How to check users, If you are not aware of how many users are on your server. The local user on the server will be able to login to the server but not on the MySQL Server. We can check and create MySQL users in Linux using the command line.

So you can check it via a command in MySQL. The local user and MySQL user are
totally different from each other.

Check Out: Recover Root Password Of Mysql Server

How To Check Users On MySQL Server:

I can also use the select * from mysql.user; command to check the users in the 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 with the name “testing“.

create database testing;

Created a user ‘ test’ with ‘password‘ using the below command.

CREATE USER 'test'@'192.168.185.129' IDENTIFIED BY "password";

How To Check Users

Check Out: Mysql Error “Too Many Connections”

Now you can see how many users are present in your database server. I created one more user ‘ aryan’ with ‘passwordaryan’. 

select user from mysql.user;

check mysql

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

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;

mysql users

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

I can also check the user with their password by running the below command.

select user,host, passwpod from mysql.user;

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

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

create mysql users

if you want to print the output and execute it on the MySQL server, you can use the below command.

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

Check Out: How To Install and Configure RDS Database On AWS Cloud

We can also get the listing of a field in mysql.user table using the below command.

desc mysql.user;

You’re done.  check users in mysql create

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment