I’m trying to print a query result to file from MySQL (SELECT blah INTO OUTFILE 'filename'), but I’m getting the following error message:
ERROR 1045 (28000): Access denied for user 'mysql_username'@'localhost' (using password: YES)
It works fine when I just select the info on the screen; it’s adding the INTO OUTFILE part that makes it give me the error.
At first I figured I just didn’t have the rights for this command (I have full create/drop rights in mySQL for this particular database but not root access on the server), but looking into the error I found indications that this error happens when the username & password don’t get properly passed to the server. I’m running this from the MySQL console on the server, so I wouldn’t think that would be the case, but the MySQL username isn’t the same as the server login, could that be the issue?
Is this something I can take care of on my own or do I need to kick it up the chain to someone with more rights (on MySQL and/or the server)?
Background: I need to purge about 1/4 of the 1000+ entries in a table, as well as the files associated with each entry. Unfortunately all the files are in the same folder and use a hash as the filename, so while I can easily grab the rows I want from the table using ranges, that won’t work for the files. I want to get the filenames out of the table before I purge the unneeded rows so I can use a shell script to delete the associated files.
According to the manual, you must have
FILEprivilege and access to the server host.