how to use a different tmp dir for INTO OUTFILE select with MySQL?
Assuming you have the FILE privilege, you should be able to specify a location other than the /tmp location. For example:

SELECT .. INTO OUTFILE '/home/foo/myfile.csv'


The other option, if you have access to the command line, is to use the -e switch:

&gt; mysql -e "SELECT * FROM foo ORDER BY bar" &gt; '/path/to/file'