AndyJarrett

Access denied for user when using INTO OUTFILE

I was getting the following error after promoting some code to my testing server:

Access denied for user '{username}'@'localhost' (using password: YES)

It turns out that the user {username} I had set up didn't have the MySQL File privilege which is something that needs to be set at a GLOBAL level.

So a quick bit of SQL can fix that. First make sure you are running the following sql against the mysql table ( USE mysql;)

update user set File_priv = 'Y' where User = '{username}';FLUSH PRIVILEGES;

You should be done at this point.