使用"加载infile"的用户拒绝访问使用mysql

时间:2015-04-07 23:08:34

标签: mysql load-data-infile

我有一个文本文件,我想加载到MySQL数据库。

当我执行命令时:

load data infile '/saurabh/chk1.txt'
   into table chk1 fields terminated by '\t' lines terminated by '\n';

我收到错误:

ERROR 1045 (28000): Access denied for user 'saurabh'@'localhost' (using password: YES)

由于我认为这是一个权限问题,我使用了show grants命令,

GRANT USAGE ON *.* TO 'saurabh'@'localhost' IDENTIFIED BY PASSWORD '*40639DEF' 

GRANT ALL PRIVILEGES ON `saurabh`.* TO 'saurabh'@'localhost' .

2 个答案:

答案 0 :(得分:0)

请参阅此帖子Mysql permission errors with 'load data'

尝试:grant file on *.* to saurabh@localhost identified by 'saurabh'

答案 1 :(得分:0)

尝试将您要加载的文件放在公共目录 (C:\Users\Public) 中,然后尝试再次加载它。这就是为我解决问题的原因。