Solved

How to use mysqlimport

Posted on 2006-07-13
2
392 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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 …

744 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

10 Experts available now in Live!

Get 1:1 Help Now