check users in mysql

How To Check Users On Server

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

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'@'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 there. 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)“

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

You’re done  check users in mysql create

LEAVE A REPLY

Please enter your comment!
Please enter your name here