![]() |
|
|
#1 |
|
Junior Member
Join Date: Oct 2006
Posts: 10
|
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 |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Jun 2004
Posts: 383
|
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 |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Oct 2006
Posts: 10
|
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 |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Jun 2004
Posts: 383
|
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. |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Oct 2006
Posts: 10
|
Re: How to load the csv file in the local machine
i m still getting the same problem.
thanks |
|
|
|
|
|
#6 |
|
Administrator
Join Date: Jun 2004
Posts: 383
|
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... |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Oct 2006
Posts: 10
|
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. |
|
|
|
|
|
#8 | ||
|
Administrator
Join Date: Jun 2004
Posts: 383
|
Re: How to load the csv file in the local machine
Quote:
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:
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. |
||
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Oct 2006
Posts: 10
|
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 |
|
|
|
|
|
#10 | |
|
Administrator
Join Date: Jun 2004
Posts: 383
|
Re: How to load the csv file in the local machine
Quote:
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; |
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
|
|
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 |