Reputation: 265
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?
Upvotes: 19
Views: 39117
Reputation: 1585
use this command:
mysql -uroot -p -e "select * from database_name.table_name" > filename.txt
Enter the password and all is done
Upvotes: 11
Reputation: 281
select * into outfile 'sd1.txt' from orders;
or
select * into outfile 'sd1.sql' from orders;
Upvotes: 6