MySqlTalk.com  

Go Back   MySqlTalk.com > MySQL > SQL syntax
User Name
Password
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread
Old 10-25-2006, 01:38 PM   #1
manu007
Junior Member
 
Join Date: Oct 2006
Posts: 10 manu007 is on a distinguished road
How to load the csv file in the local machine

hi all,
i am looking for the syntax through which i can load a csv file in my local machine instead of a server. In other words i do have the option to specify the path like "c:\desktop\filename"
thanks
manu007 is offline   Fork this post Reply With Quote
Old 10-26-2006, 02:23 PM   #2
Administrator
Administrator
 
Join Date: Jun 2004
Posts: 383 Administrator is on a distinguished road
Re: How to load the csv file in the local machine


Try forward slash instead of backslash so for example:

LOAD DATA INFILE 'c:/desktop/filename' INTO TABLE t1 (column1, @dummy, column2, @dummy, column3);


For more details, read this page carefully inculding the comments:

http://dev.mysql.com/doc/refman/5.0/en/load-data.html

Administrator is offline   Fork this post Reply With Quote
Old 10-26-2006, 03:55 PM   #3
manu007
Junior Member
 
Join Date: Oct 2006
Posts: 10 manu007 is on a distinguished road
Re: How to load the csv file in the local machine

thanks for replying.
I am getting this error now:
Cant create/write to file "c:/desktop/offers_out.csv"

the code i m writing is:
SELECT * INTO OUTFILE 'c:/desktop/offers_out.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM x.test

thanks
manu007 is offline   Fork this post Reply With Quote
Old 10-26-2006, 11:07 PM   #4
Administrator
Administrator
 
Join Date: Jun 2004
Posts: 383 Administrator is on a distinguished road
Re: How to load the csv file in the local machine

Hmm, sounds like a permissions problem not a MySQL problem. Does the file exist already? If so rename it and see if it can write to the file if it doesn't exist. On the other hand, if it doesn't exist, try creating the file with empty data and maybe then it will be able to write to it.


Administrator is offline   Fork this post Reply With Quote
Old 10-27-2006, 09:34 AM   #5
manu007
Junior Member
 
Join Date: Oct 2006
Posts: 10 manu007 is on a distinguished road
Re: How to load the csv file in the local machine

i m still getting the same problem.
thanks
manu007 is offline   Fork this post Reply With Quote
Old 10-27-2006, 12:34 PM   #6
Administrator
Administrator
 
Join Date: Jun 2004
Posts: 383 Administrator is on a distinguished road
Re: How to load the csv file in the local machine

Read this page including the comment:

http://dev.mysql.com/doc/refman/5.0/...ot-create.html

Per the comment, if you have an antivirus program turn it off and try it.
Try editing the config file to specify the temp directory.
Double check how much hard drive space you have...
Administrator is offline   Fork this post Reply With Quote
Old 10-27-2006, 02:04 PM   #7
manu007
Junior Member
 
Join Date: Oct 2006
Posts: 10 manu007 is on a distinguished road
Re: How to load the csv file in the local machine

it talks about the server. I cant do that, it is a production server. I dont know where i can stop the antivirus. I dont think so it is running also.
The server is a linux machine and i m working on windows environment.
manu007 is offline   Fork this post Reply With Quote
Old 10-27-2006, 02:31 PM   #8
Administrator
Administrator
 
Join Date: Jun 2004
Posts: 383 Administrator is on a distinguished road
Re: How to load the csv file in the local machine

Quote:
Originally Posted by manu007
The server is a linux machine and i m working on windows environment.

Ah. I assumed you were working on one machine.

I just looked at your code. So you're trying to pull data from the server into your local file?
Does your syntax actually look like
Quote:
FROM x.text
?

How are you accessing mysql?
Navicat? PhpMyAdmin? SSH?


The code you're trying to run would assume a mysql client and server. The place to specify the temp location would be the client version of mysql which would reside on your machine. Turning off the antivirus would also be on your local machine.
Administrator is offline   Fork this post Reply With Quote
Old 10-27-2006, 03:01 PM   #9
manu007
Junior Member
 
Join Date: Oct 2006
Posts: 10 manu007 is on a distinguished road
Re: How to load the csv file in the local machine

thanks for replying.
I am running a mysql query browser and opening up the new script tab and writing it there:
This is the code i m using
select * into OUTFILE 'C:/Documents and Settings/offers_out.csv'
FIELDS TERMINATED BY ',' FROM training.ac_client;


"The place to specify the temp location would be the client version of mysql which would reside on your machine." Where can i find this. I am using client version of mysql which is query browser.

i think antivirus is down in my machine.
thanks
manu007 is offline   Fork this post Reply With Quote
Old 10-27-2006, 04:30 PM   #10
Administrator
Administrator
 
Join Date: Jun 2004
Posts: 383 Administrator is on a distinguished road
Re: How to load the csv file in the local machine

Quote:
Originally Posted by manu007
thanks for replying.
I am running a mysql query browser and opening up the new script tab and writing it there:
This is the code i m using
select * into OUTFILE 'C:/Documents and Settings/offers_out.csv'
FIELDS TERMINATED BY ',' FROM training.ac_client;


"The place to specify the temp location would be the client version of mysql which would reside on your machine." Where can i find this. I am using client version of mysql which is query browser.

i think antivirus is down in my machine.
thanks

I've never used the query browser personally, but go to the directory where you installed the query browser and see if there's a my.ini or similar file there somewhere...

Also, is you table name training.ac_client? I don't think that's a valid table name. If you want the column ac_client from the table called training, then I believe the syntax should be

select ac_client into OUTFILE 'C:/Documents and Settings/offers_out.csv'
FIELDS TERMINATED BY ',' FROM training;
Administrator is offline   Fork this post Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing CSV file for numeric columns wrandall General 2 10-19-2005 11:42 AM
Does adding a deny to a cgi file work for parameters added to the file? Azkaban Robots & Spiders 0 09-06-2005 09:52 PM
Import Access, Excel and data of other formats to MySQL by Navicat NavicatGuy Articles 0 08-17-2004 01:08 AM
3.3 Creating and Using a Database Administrator Documentation 13 06-09-2004 04:56 PM
2 Installing MySQL Administrator Documentation 103 06-09-2004 02:53 AM



All times are GMT -4. The time now is 06:44 AM.



Powered by: vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Google
  Web http://www.mysqltalk.com
DISCLAIMERS:
1. We have no commercial interest in this site.
Banner Ads and Subscriptions will only be used to help pay for hosting and maintenance costs.
2. MySQLTalk.com is NOT affiliated with MySQL AB in any way.
3. MySQLTalk.com is NOT endorsed by MySQL AB in any way.
4. Please do not post any content that is harmful to MySQL or MySQL AB, meaning no misleading or obsolete information will be tolerated.
Well-founded constructive criticism meant to help the community is permitted.
5. This website is founded with the goal of improving the MySQL community.
We not only tolerate newbies, we encourage them.
Please do not ask newbies to "read the manual".