views:

2365

answers:

1

Hello,

I cannot get the following code to generate any output. The MySQL user has "all" grant level, /tmp is writable, the query returns a results set.

mysql> SELECT field FROM test_table WHERE condition='test'
    -> INTO OUTFILE '/tmp/test.csv'
    -> FIELDS TERMINATED BY ','
    -> ENCLOSED BY '"'
    -> LINES TERMINATED BY '\n';
Query OK, 1 row affected (0.00 sec)

mysql>
[1]+  Stopped                 mysql
[root@web1 ~]# cat /tmp/test.csv
cat: /tmp/test.csv: No such file or directory

Should I be seeing different output from MySQL in case of failure?

Can I verify the result further than "1 row affected"?

Thanks.

+5  A: 

The files generate by the outfile clause are created on the mysql server host. Please make sure you are looking on the mysql server host as it seems you are on the client host which most likely isn't the mysql server host.

See http://dev.mysql.com/doc/refman/5.0/en/select.html in the section about outfile for documentation regarding this.

HTH,

-Dipin

Dipin
Thanks Dipin, you are correct that this is not the DB server. Many thanks
Andy
No problem. Glad I could help. Cheers!
Dipin
Dipin you just saved me beating my head all night. Thanks!
jerrygarciuh