mysql> grant FILE on *.* to matt;
2. make sure mysql can write to the destination directory - I used /tmp
mysql> select 'hello world' into outfile '/tmp/destination.txt';
3. select your csv output
SELECT order_id,product_name,qty
FROM orders
INTO OUTFILE '/tmp/destination.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
You need an output directory where owner is root:root and sticky bit is set with chmod 1777
ReplyDelete