INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

INTO OUTFILE Directory

INTO OUTFILE Directory

(OP)
Hello.

I'm doing an SQL query and converting it to XLS. When I run the query on the localhost DB, The file outputs to the specified location at C:/tmp/myfile.csv. However, when I run the query on the live DB, it outputs to the DB server at /home/mysql/csv/myfile.csv. As result, I can only see the file if I SSH into the server machine. Is there a way to get the the live file to export to my local machine? Pointing it to C:/tmp/myfile.csv has no result.

CODE --> SQL

SELECT p.paymentdate, p.filenumber, p.paymentstatus, p.paymentamount, d.fullname, d.address, d.city, d.state, d.zip, d.makepayabletoname, d.makepayabletoaddress, d.makepayabletocity, d.makepayabletostate, d.makepayabletozip, d.emailaddress 
FROM payments p, dbase d 
WHERE p.filenumber = d.filenumber 
AND p.paymentstatus = "pending" 
AND p.paymentdate = curdate() 
INTO OUTFILE "C:/tmp/text.csv" 
FIELDS TERMINATED BY  "," 
ENCLOSED BY "\"" 
ENCLOSED BY "\ " 
ESCAPED BY "\ \ " 
LINES TERMINATED BY "\n" 

[img="http://3dgstudios.com/images/gorilla.jpg"]

"Any sufficiently advanced technology is indistinguishable from magic" [Arthur C. Clark]</td></tr></table>

RE: INTO OUTFILE Directory

if you have mysql installed locally, you can use that to connect to the remote host and achieve the desired result
from a command line:
c:\>mysql -h<host> -u<user> -p -e"Select statement" database [table optionally] > c:\tmp\myfile.csv

the password will be requested before the query will execute.

if you have the ,ysql workbench installed you will need to cd into its installed directory to run the command as it probably wont have registered the path to mysql.exe (found in the workbench folder).

firewalls and user hosts permissions may also hinder your success.


Cheers
K

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close