Mysql 第 1 行的错误 1045 (28000):用户 'abc'@'slave4' 的访问被拒绝(使用密码:YES)

Mysql ERROR 1045 (28000) at line 1: Access denied for user 'abc'@'slave4' (using password: YES)

我可以使用相同的凭据远程访问服务器

mysql --host="x.x.x.67" --user="abc" --password="xxyy" --database="dbname"
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 81480482

但是当我尝试远程写入文件时抛出错误

 mysql --host="10.64.133.67" --user="abc" --password="xxyy" --database="dbname" -se "select * from dbname.param  INTO OUTFILE '/tmp/abcd.txt' FIELDS TERMINATED BY '\n' LINES TERMINATED BY '\n';"
 ERROR 1045 (28000) at line 1: Access denied for user 'abc'@'slave4' (using password: YES)

我可以毫无例外地触发 select 查询。我完全不知道为什么我在写

时会出现异常

INTO OUTFILE '/tmp/abcd.txt' FIELDS TERMINATED BY '\n' LINES TERMINATED BY '\n'

进入 tmp file.Thanks.

文件权限对我有用:-

GRANT FILE ON *.* TO 'abc'@'%';
FLUSH PRIVILEGES;

您的用户缺少 FILE 权限。