Hello,
How do I list out all users accessing a list of on the mysql server.
Thanks Jean
-
Any user that can connect to the database can be found in the user table.
When a user tries to connect to the database, MySQL checks that that particular username/host/password combination has permission to connect.
It is important to understand that the host and user together determine an individual permission for connecting. User Nosipho may have access from host A, and not from host B. In fact, user Nosipho on host B may be an entirely different user.
So to find out who can connect and from where run this sql
SELECT host,user FROM user;
This is a good introduction to MySQL permissions
Jean : running that shows me no db selectednickf : not sure, but I think there's a database called "mysql" ? Try `USE mysql` or `SELECT host,user FROM mysql.user`Nifle : @nickf - Yup global privileges are stored in the `mysql.user` table. But you can have privileges per database too so you can use `SELECT host,user FROM my_very_own_db.user`Jean : there is a user and host table. host is emptyNifle : @Jean - I think that means they can only connect locallyFrom Nifle -
The query you want is this:
SELECT user, host FROM mysql.user
And you probably need to be logged in as root in order to see the
mysql
table.If you want to run an
ssh
command on one machine and have it return the MySQL users on a different machine, that's a little more complicated, but not terribly hard.From Jason Swett
0 comments:
Post a Comment