Show MySQL users from command line

Some times when you only have the MySQL command line client available and you need to “see” what users/grants are setup on the server here is a great little piece that gives you this information:
# mysql -e “SELECT User,Host,Password,Super_Priv,Grant_Priv,Repl_slave_priv,Repl_client_priv FROM mysql.user;”
+——+———-+———-+————+————+—————+—————-+
| User | Host | Password | Super_Priv | Grant_Priv | Repl_slave_priv | Repl_client_priv |
+——+———-+———-+————+————+—————+—————-+
| root | localhost | | Y | Y | Y | Y |
| root | hostname | | Y | Y | Y | Y |
| root | 127.0.0.1 | | Y | Y | Y | Y |
+——+———-+———-+————+————+—————+—————-+
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: