Solved

How to use mysqlimport

Posted on 2006-07-13
2
399 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:Richard Quadling
ID: 17106704
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to stop user from going back to a previous page in PHP 3 31
error log using ftp 7 39
PHP Form Calculate Total Price 10 41
website maintenance mode 1 17
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …

776 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