VnLamp

Go Back   VnLamp > Khu vực Training > Linux Advance > Mysql Server/Cilent

Trả lời
 
LinkBack Ðiều Chỉnh Xếp Bài
Showing All Grants With MySQL
Old
  (#1 (permalink))
 
Status: Offline
Posts: 459
Tham gia: Dec 2007
Administrator
 
patrick's Avatar
Default Showing All Grants With MySQL - 26-12-2008, 19:26 26-12-2008

Users are identified with both a user and a host. If you want to show all of the grants for all users, you need to first look at the mysql.user table:


[usr-1@srv-1 ~]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10863 to server version: 4.1.10a
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> select User,Host from mysql.user;
+------+---------------------------+
| User | Host |
+------+---------------------------+
| are | 10.10.10.10 |
| are | 10.10.10.11 |
| are | 10.50.100.0/255.255.255.0 |
| are | 10.50.100.112 |
| are | 10.50.100.2 |
| | localhost |
| are | localhost |
| root | localhost |
| | srv-1.networking7by24.com |
| root | srv-1.networking7by24.com |
+------+---------------------------+
10 rows in set (0.00 sec)


Some of these permissions overlap. That is, the 10.50.100.0 entry include the other individual hosts. We can now show the grants for individual users:

mysql> show grants for are@'10.50.100.0/255.255.255.0';
+-----------------------------------------------------------------+
| Grants for are@10.50.100.0/255.255.255.0 |
+-----------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'are'@'10.50.100.0/255.255.255.0'
IDENTIFIED BY PASSWORD '4bc9fc1d367a0b23' |
| GRANT ALL PRIVILEGES ON `arewedown`.* TO 'are'@'10.50.100.0/255.255.255.0' |
| GRANT ALL PRIVILEGES ON `mysql`.`arewedown` TO 'are'@'10.50.100.0/255.255.255.0'|
+-----------------------------------------------------------------+
3 rows in set (0.00 sec)
mysql> show grants for are@10.10.10.10;
+--------------------------------------------------------------+
| Grants for are@10.10.10.10 |
+--------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'are'@'10.10.10.10' |
| GRANT ALL PRIVILEGES ON `arewedown`.* TO 'are'@'10.10.10.10' |
+--------------------------------------------------------------+
2 rows in set (0.00 sec)
mysql>


Kinh nghiệm của chúng tôi là kiến thức của bạn
  Send a message via Yahoo to patrick  
Trả Lời Với Trích Dẫn
Trả lời


Ðiều Chỉnh
Xếp Bài

Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt
Trackbacks are Mở
Pingbacks are Mở
Refbacks are Mở


Múi giờ GMT. Hiện tại là 02:23 23-05-2012.