Q: Save MySQL query results into a text file I want to save a MySQL query result to to a text file like this:
SELECT * FROM orders INTO OUTFILE '/data.txt'

However, I don't have write permission on the server. Where can I write to or is there a simpler way?

A: select * into outfile  'sd1.txt' from orders;

or 
select * into outfile  'sd1.sql' from orders;


A: use this command:
mysql -uroot -p -e "select * from database_name.table_name" > filename.txt

Enter the password and all is done
