Select * into OUTFILE

I ma connected to the MySQL Server by a trusted connection on  a remote PC using work bench

I am using the Select *  into OUTFILE statement

Select * 
into OUTFILE 'C:\\testexport1.xls'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
from tblmemberdraw_recipients;

Open in new window


This is working but is exporting the file to the server instead of my PC, how do I get the file to be exported to my PC instead of the server.
BrogrimInformation Systems Development ManagerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tomas Helgi JohannssonCommented:
Hi!

Select * ... INTO OUTFILE  ...
can only output to a file on the server itself.
You will need to use something like
mysql ... -e "SELECT * FROM ... " > myoutputfile

Regards,
     Tomas Helgi
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BrogrimInformation Systems Development ManagerAuthor Commented:
Tomas

Does the -e mean echo in a command prompt?

I use workbench for all operations, does the above mean using the command prompt?

Thanks
0
Tomas Helgi JohannssonCommented:
Hi!

This was a command prompt example where -e stands for excecute and following is your query in "" brackets.
If you use MYSQL workbench you can execute your sql in a query tab where the
result is shown in a Result-tab which you then can export into file of your choice.


Regards,
    Tomas Helgi
0
BrogrimInformation Systems Development ManagerAuthor Commented:
OK, was hoping to be automate the complete procedure within Workbench but as you explained not possible without command prompt.

Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.