Solved

How to use mysqlimport

Posted on 2006-07-13
2
405 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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:Richard Quadling
ID: 17106704
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

688 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