Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL select into outfile does not write the file to the directory that I choose

The following command:

select * 
  INTO OUTFILE '\home\user1\NetBeansProjects\project1\dumps\theData.csv'
  FIELDS TERMINATED by ','
  LINES TERMINATED BY '\n'
  from database1

Does not write a file called theData.csv to the specified directory.

  1. How do I get this file to be written to the specified directory?
like image 857
CodeKingPlusPlus Avatar asked Jan 16 '13 19:01

CodeKingPlusPlus


1 Answers

The path doesn't seem write - if you are on Linux server then I would expect the path with contains slashes and not backslashes, if you are on Windows machine I would expect the driver letter to appears somewhere (and you can't write on a network folder - just local to the DB server machine).

Also, just to eliminate permissions issue or trying to override existing file, try to write to '/tmp/non_existing_file.csv'.

like image 84
user3111988 Avatar answered Sep 18 '22 12:09

user3111988