I created some data files with 'outfile ' command.

The files are created in the mysql folder.{I use WAMP}
I want to create those files in another directory.

How can I do that?

Thankx in advance.

Mention the full path to the destination where you mention the file name e.g.

SELECT col1, col2 INTO OUTFILE 'c:\mysql\data.txt'
FIELDS TERMINATED BY ',' 
....

Mention the full path to the destination where you mention the file name e.g.

SELECT col1, col2 INTO OUTFILE '/home/data.txt'
FIELDS TERMINATED BY ',' 
....

I used

SELECT * into OUTFILE  '/reports/1.txt' from test.table1;

And it says,

Can't create/write to file '\reports\1.txt' (Errorcode:2)

Please help

Sorry for that, I didn't realize that you are using Windows. You should use 'c:\mysql\data.txt' instead of the path I mentioned.

Sorry for that, I didn't realize that you are using Windows. You should use 'c:\mysql\data.txt' instead of the path I mentioned.

gee thankx..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.