I switched from being a long term windows user to mac.
Now I face this problem trying to save a query to a csv file:
mysql> SELECT * FROM mytable
-> INTO OUTFILE '/Users/localuser/Documents/myfolder/test.csv'
-> FIELDS TERMINATED BY ','
-> ENCLOSED BY '"'
-> LINES TERMINATED BY '\n';
But i get:
ERROR 1 (HY000): Can't create/write to file
'/Users/localuser/Documents/myfolder/test.csv' (Errcode: 13 "Permission denied")
I think it is something about setting permission but i have not found a solution that works for my mac osx. thank you in advance.
Please take into account that this ones works MySQL writing on a text file
But what I am looking for is more the operation to set any directory so that *.csv files can be put there by the sql server.
I meet the same problem, and I find that it is relevant to file permission of Mac OS, not relevant to MySQL.
The solution is to make all the folders in the path have permission of 755 (read and execution) and to make the folder putting the csv file has the permission of 777 which can write the file.
So in your case, the folders in '/Users/localuser/Documents' should have 755 permission and the folder 'myfolder' should have 777 permission.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With