Question

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?
Était-ce utile?

La solution

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'.

Autres conseils

Are you using Windows or Linux? You might need to change the back slashes to forward slashes. Also you need to change the settings in MySQL Query browser or Workbench to view this folder as default.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top