Solved

How to use mysqlimport

Posted on 2006-07-13
2
396 Views
Last Modified: 2013-12-12
Hi experts,

I'm following the guide located here http://www.delau.net/php/geoip.html to import a CSV file into a db but i can't get past step 2 because i have never used the mysqlimport system before. I don't what it is or how to use it.

Do i need shell/ssh/telnet access to the server in order to run the commands?

Thanks
0
Comment
Question by:blaadom
2 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 125 total points
ID: 17103860
To import the csv as suggested then you will require shell/ssh/telnet access to the server.  However you can do it another way.  If you have the ability to query the database and you have the load data local infile ability granted on the server you can use the following statement;

Load Data Local InFile 'C:\temp\x.csv'
into table x
fields terminated by ','

The extract for the full syntax is below from the manual.  This does the same job as mysqlimport but you just need access to connect to the server.

13.2.5. LOAD DATA INFILE Syntax
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt'
    [REPLACE | IGNORE]
    INTO TABLE tbl_name
    [FIELDS
        [TERMINATED BY 'string']
        [[OPTIONALLY] ENCLOSED BY 'char']
        [ESCAPED BY 'char' ]
    ]
    [LINES
        [STARTING BY 'string']
        [TERMINATED BY 'string']
    ]
    [IGNORE number LINES]
    [(col_name_or_user_var,...)]
    [SET col_name = expr,...)]

0
 
LVL 40

Expert Comment

by:RQuadling
ID: 17106704
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses how to create an extensible mechanism for linked drop downs.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now