If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Export MySQL to a text file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-22-11, 03:09
melgra70 melgra70 is offline
Registered User
 
Join Date: Mar 2011
Location: Sydney, Australia
Posts: 58
Export MySQL to a text file

I'm trying to export my tables from my MySQL database, horsedb, to text files. I have used the following code to export the first table, horse and there were no errors indicated in processing my code. However, I can't find the text file I've created. What am I doing wrong?

use horsedb;
SELECT * FROM horse INTO OUTFILE 'C:\Users\Melgra\Desktop\horsefile.txt'
FIELDS terminated by ','
LINES terminated by '\r\n';
Query OK, 9 rows affected (0.01 sec)

Thank you.
Reply With Quote
  #2 (permalink)  
Old 04-22-11, 04:10
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
Quote:
Originally Posted by melgra70 View Post
However, I can't find the text file I've created.
it's on the server
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 04-22-11, 06:22
melgra70 melgra70 is offline
Registered User
 
Join Date: Mar 2011
Location: Sydney, Australia
Posts: 58
How do I search for the file?
Why doesn't it save to my desktop when that's the location I indicated?
Reply With Quote
  #4 (permalink)  
Old 04-22-11, 06:55
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
Be careful on Windows machines, for \ you will need to double these \\ so C:\Users\Melgra\Desktop\horsefile.txt should read C:\\Users\\Melgra\\Desktop\\horsefile.txt or alternatively your can use single forward quote C:/Users/Melgra/Desktop/horsefile.txt
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #5 (permalink)  
Old 04-22-11, 07:55
melgra70 melgra70 is offline
Registered User
 
Join Date: Mar 2011
Location: Sydney, Australia
Posts: 58
Ronan, you're a genius! You're the best!
Thanks so much!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On