coolcommands.com - the search engine for unix sysadmins :: unix commands and scripts
Monday September 6, 2010


 Home
 Search
 Advanced Search
 Category Search
 Affiliates
 Acknowledgements
 Cool Links

Username

Password

Remember me
Forgot your password?
Create an account

Who's Online
We have 30 guests online

Newest Member

Starmamex

Hit Counter
4760820 Visitors

cool Statistics
coolcommands:1313
Categories:82
Total queries:523831
Members:4281





Search coolcommands.com
Search Keyword:


coolcommand

how to show grants for a user in MySQL
Description

First, login to MySQL with the root user:

# mysql -u root -p

Next, to see all your databases:

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| phpbb3 |
| samhain |
| test |
| visapps |
| wikidb |
+--------------------+
7 rows in set (0.12 sec)

Get a list of all users in MySQL:

mysql> select User,Host from mysql.user;
+-----------+----------------------------+
| User | Host |
+-----------+----------------------------+
| wikiuser | % |
| root | 127.0.0.1 |
| apache | localhost |
| invadmin | localhost |
| invlec | localhost |
| nagios | localhost |
| root | localhost |
| samhain | localhost |
| wikiuser | localhost |
| wikiuser | localhost.localdomain |
| apache | aixserver1 |
| invadmin | aixserver1 |
| invlec | aixserver1 |
| root | aixserver1.mydomain.com |
+-----------+----------------------------+
17 rows in set (0.16 sec)

To see the grants for a particular user:

mysql> show grants for root@'aixserver1.mydomain.com';
+--------------------------------------------------------------------------------------+
| Grants for root@aixserver1.mydomain.com |
+--------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'aixserver1.mydomain.com' WITH GRANT OPTION |
+--------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> show grants for samhain@localhost;
+----------------------------------------------------------+
| Grants for samhain@localhoat |
+----------------------------------------------------------+
| GRANT USAGE ON *.* TO 'samhain'@'localhost' |
| GRANT UPDATE ON `samhain`.`log` TO 'samhain'@'localhost' |
+----------------------------------------------------------+
2 rows in set (0.00 sec)
Example

show grants for someuser@localhost;

Return to search results

Random coolcommands

coolcommand: mtlib - how to list the devices in the library in an expanded device list
Example: mtlib -l /dev/lmcp0 -DE
[show me the details]
coolcommand: how to get information about a database in Sybase
Example: sp_helpdb dbname
[show me the details]
coolcommand: generatecoredump.sh - script to generate a core dump of a WAS appserver
Example: generatecoredump.sh Appserver Node
[show me the details]
coolcommand: mknfs - how to enable the nfs server in IBM AIX
Example: mknfs -B
[show me the details]

coolcommands.com - the search engine for UNIX sysadmins :: unix commands and scripts



FREE
myPMS

Password
Management
System

by

LVOware.com




Top 5 Submitters

lvo1138
audet37
kah00na32
Mariom24
lebjf00013

Top 5 Searches

Category Solaris42690
Category AIX38082
Category General UNIX34254
solaris20802
aix19388

Terms of Use
Privacy
Contact


 
coolcommands.com © 2010. All Right Reserved.
Programming by PRATTICO Consulting . Hosting by Apricusum