2013年3月31日星期日

有select 没有select into file 权限


mysql> select distinct ip from T_ipinfo into outfile "/tmp/ip.txt";
ERROR 1045 (28000): Access denied for user 'cds_web'@'211.151.181.209' (using password: YES)
mysql> select distinct ip from T_ipinfo;                          
+-----------------+
| ip              |
+-----------------+
| 10.11.80.102    |
| 10.11.80.103    |
| 10.11.80.108    |
 
 
查看file 的权限选项:
 
mysql> select  user,host,File_priv  from user;
+------------+-----------------------------+-----------+
| user       | host                        | File_priv |
+------------+-----------------------------+-----------+
| root       | localhost                   | Y         |
| root       | SHANGH21-104-DX-APP.opi.com | Y         |
| root       | 127.0.0.1                   | Y         |
| root       | ::1                         | Y         |
| monitor    | 127.0.0.1                   | N         |
| dba        | localhost                   | Y         |
| cds_master | 127.0.0.1                   | N         |
| cds_web    | 211.151.181.21             | N         |
| dbbak      | %                           | N         |
+------------+-----------------------------+-----------+
9 rows in set (0.00 sec)
 
mysql>
 
没有file 的权限就给嘛
mysql> grant FILE on cds.* to cds_web@'211.151.181.21';
ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
 
既然出错了
 
google 之:
After googling i cme to know that “the FILE privileges are global and cannot be applied to a single database”
So correct SQL Statement is:
mysql> grant FILE on *.* to cds_web@'211.151.181.21';
Query OK, 0 rows affected (0.00 sec)
 
mysql>

没有评论:

发表评论