情况
我有一个 mysql 服务器,用户配置很混乱:有两个不同的条目具有相同的登录名admn
。
mysql> select user,host,grant_priv from mysql.user where user="admn";
+------+---------------------------+------------+
| user | host | grant_priv |
+------+---------------------------+------------+
| admn | 192.168.0.0/255.255.255.0 | N |
| admn | 192.168.0.21 | Y |
+------+---------------------------+------------+
2 rows in set (0.00 sec)
请注意,只有第二个(主机192.168.0.21
)具有“授予”权限。
为了完整起见,这里是两个用户权限的视图:
mysql> show grants for 'admn'@'192.168.0.0/255.255.255.0';
+------------------------------------------------------------------------------------------------+
| Grants for admn@192.168.0.0/255.255.255.0 |
+------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'admn'@'192.168.0.0/255.255.255.0' IDENTIFIED BY PASSWORD '---' |
+------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> show grants for 'admn'@'192.168.0.21';
+-----------------------------------------------------------------------------------------------------+
| Grants for admn@192.168.0.21 |
+-----------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'admn'@'192.168.0.21' IDENTIFIED BY PASSWORD '---' WITH GRANT OPTION |
+-----------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql服务器的版本是:
mysql> select version();
+-----------------------+
| version() |
+-----------------------+
| 5.1.63-0+squeeze1-log |
+-----------------------+
1 row in set (0.00 sec)
问题
当我使用的凭据从192.168.0.21
机器登录时,我被识别为:adm
'admn'@'192.168.0.0/255.255.255.0'
mysql> select user(), current_user();
+-------------------+--------------------------------+
| user() | current_user() |
+-------------------+--------------------------------+
| admn@192.168.0.21 | admn@192.168.0.0/255.255.255.0 |
+-------------------+--------------------------------+
1 row in set (0.00 sec)
并且由于该帐户没有“授予”特权,因此我对特权管理感到困惑。
问题
如何访问'admn'@'192.168.0.21'
帐户?