This happened with a select statement which writes the result to an external file. I didn't remember the privilege "FILE" must be granted on *.* for this to work successfully, it wasn't actually an authentication issue as it implies since I was already in the SQL prompt and doing the query.
INTO OUTFILE '/tmp/result.txt'
Keep in mind that the above won't work even with permissions set to 777, your user must have privileges from MySQL to write to the filesystem.