select into outfile 需要file on *.* 的权限

建立测试账号

(root@localhost) [mysql]>grant all privileges on test.* to "gf"@"%" identified by "gaofei";


使用测试账号登陆,并执行into outfile操作

(gf@localhost) [test]>select * into outfile '/home/mysql/itpub_a.dat' from itpub_A;
ERROR 1045 (28000): Access denied for user 'gf'@'%' (using password: YES)

重新赋予file权限,提示该权限是global,必须使用*.* 方式

(root@localhost) [mysql]>grant file on test.* to "gf"@"%";
ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
(root@localhost) [mysql]>grant file on *.* to "gf"@"%";
Query OK, 0 rows affected (0.00 sec)


重新赋权后,再次执行into outfile成功导出

(gf@localhost) [test]>select * into outfile '/home/mysql/itpub_a.dat' from itpub_A;
Query OK, 3 rows affected (0.00 sec)



参考链接:http://www.blogjava.net/xiaomage234/archive/2011/11/04/362677.html




你可能感兴趣的:(MySQL)