I am running the MySQL Workbench 6.2 CE on Windows7. I have an output table of 200,000 rows and I need to save it. I will have to repeat this task, so I would like to iterate the following code:
SELECT * FROM mytable
INTO OUTFILE 'mytable.csv'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n';
This saves my output but I cannot access it. It seems it is saved in the server database. I have the server installed in my desktop so I should be able to access it. Do you know how could I find the filepath to my saved csv files?
Edit1: I can save it manually in the Workbench GUI but I would like to find a code-based solution as I have to iterate this process many times.
Edit2: Putting all the file path doesn't work. It gives an error: Errcode: 13 - Permission denied
PS: Sorry if it is a basic question, I am new to MySQL.
Best Answer
If this is a one-time thing, you can do the following to export the result into
csv
file using MySQL workbench:then the result will appear in the result table (area) all you need to do use export button in that area:
Otherwise, if you want to create output file you can do it by using a shared folder:
//my_pc/folder/test.csv
that both machines have read/write accessd:/test.csv
and save the file into any location you want.