1

I have used following query for export query result as csv file..

QUERY

 SELECT * FROM city WHERE loc7 = 33 
INTO OUTFILE 'D://file.csv'
FIELDS TERMINATED BY ','

This above query has Excecuted phpmyadmin 3.3.9 and mysql version()5.5.8 and this same query has returned error for Unrecognized Keyword FIELDS and Unrecognized kerword TERMINATED in phpmyadmin 4.5.4 and mysql version()5.7.13-0ubuntu0.16.04.2 how to solve this problem? is there any way available to overcome this prob?

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
Balakumar B
  • 770
  • 5
  • 17
  • 41
  • 2
    it should be either d:/file.csv or d:\\file.csv – e4c5 Sep 21 '16 at 05:25
  • but query exceuted and i got csv file from correct path that's not matter @e4c5 – Balakumar B Sep 21 '16 at 05:28
  • then why did you post this question?? – e4c5 Sep 21 '16 at 05:33
  • path does not matter.. query has executed mysql version `5.5.8` in phpmyadmin 3.3.9 at same query does not execute in mysql version `5.7.13-0ubuntu0.16.04.2` i asked question how fix this problem thats way i am asked that question i didn't ask question regarding path. i already mentioned this query excected and i got csv file from given path.. @ e4c5 – Balakumar B Sep 21 '16 at 05:39

1 Answers1

0

It could be you have FROM in the wrong position.

From the MySQL Documentation:

SELECT a,b,a+b INTO OUTFILE '/tmp/result.txt' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'
FROM test_table;

Try using:

SELECT * 
INTO OUTFILE 'D://file.csv'
FIELDS TERMINATED BY ','
FROM city WHERE loc7 = 33 
Scot Matson
  • 745
  • 6
  • 23
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107