“加载数据”的 Mysql 权限错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1014724/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 13:32:42  来源:igfitidea点击:

Mysql permission errors with 'load data'

mysqlload-data-infilemysql-error-1045

提问by sutee

I am running into a permission error when trying to load data from a flat file database dump into a new table. I know that the schema of the file and my table is the same and I tried tweaking the permissions. What else should I try?

尝试将数据从平面文件数据库转储加载到新表时遇到权限错误。我知道文件的架构和我的表是一样的,我尝试调整权限。我还应该尝试什么?

mysql> load data infile 'myfile.txt' into table mytable fields terminated by ',' enclosed by '"';
ERROR 1045 (28000): Access denied for user 'user'@'%' 

grant all on mytable.* to 'user'@'%

回答by ólafur Waage

Here's a threadon the MySQL forums that discusses exactly this.

这是MySQL 论坛上的一个线程,正好讨论了这一点。

Here's the answer, posted by Ken Tassell

这是答案,由 Ken Tassell 发布

Problem resolved using the command below:

问题使用以下命令解决:

grant file on *.* to kentest@localhost identified by 'kentest1';

回答by Bill Karwin

You might have MySQL privileges on the destination table, but you also need the FILEprivilege to execute LOAD DATA, and of course the MySQL Server process needs operating-system privileges to the data file too.

您可能在目标表上拥有 MySQL 权限,但您还需要FILE执行权限LOAD DATA,当然 MySQL 服务器进程也需要对数据文件的操作系统权限。