In case you want to fetch/export the result of a mysql query into a text file, but you don´t have the option to use the OUTFILE command you can simple use the following bash command:
:~$ mysql -u USER -p PASSWORD -h HOST --silent --skip-column-names -e 'select field1, field2, field3 from table' > query-result.csv