[MySQL] How to Solve ERROR 1045 (28000): Access denied for user
When I tried to export to a CSV file in MySQL, the following error occurred:
mysql> select * from users into outfile "./users.csv" FIELDS TERMINATED BY ',';
ERROR 1045 (28000): Access denied for user 'username'@'localhost' (using password: YES)
It seems the MySQL user didn’t have FILE handling permissions, so it couldn’t output to the CSV file.
By granting permissions with a GRANTS query, you can enable file output via queries.
GARANTS FILE ON *.* TO username@localhost;
That’s all.
That’s all from the Gemba.