How to Save the sql data to a csv file

Unfortunately my bench is not working and i want to save the data in the csv format ,so can i use the following type of queries for saving it…
SELECT order_id,product_name,qty
FROM orders
WHERE foo = ‘bar’
INTO OUTFILE ‘/var/lib/mysql-files/orders.csv’
FIELDS TERMINATED BY ‘,’
ENCLOSED BY ‘"’
LINES TERMINATED BY ‘\n’;
But is giving me an error when i am running it in mysql console…
ERROR 1045 (28000): Access denied for user ‘ea106b3e4781622f’@‘localhost’ (using password: YES)

Try connecting using: mysql -u root -p

Thanks …its worked for me