我有一个存储过程,其中有一个准备好的select ... into outfile语句。 当我尝试以root身份调用该过程时,它运行良好,但当我尝试将其作为另一个用户调用时,我一直拒绝访问。
Show grants:
GRANT FILE ON *.* TO 'mls'@'localhost' IDENTIFIED BY ...
GRANT ALL PRIVILEGES ON `mls`.* TO 'mls'@'localhost' WITH GRANT OPTION
我错过了什么吗? 提前感谢任何想法。
答案 0 :(得分:0)
这适用于MySQL 5.5:
以root身份登录
USE mls;
GRANT FILE ON *.* TO 'mls'@'localhost' IDENTIFIED BY ...;
GRANT SELECT, EXECUTE ON `mls`.* TO 'mls'@'localhost';
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1);
DELIMITER //
CREATE PROCEDURE simpleproc() begin select * from t1 into outfile 'into_outfile'; END //
DELIMITER ;
以mls身份登录
USE mls;
CALL simpleproc();
对于MariaDB,您需要SUPER权限:https://mariadb.com/kb/en/mariadb/documentation/sql-commands/data-manipulation/select-into-dumpfile/