Ask the Expert

Finding a utility to import fixed field data

I need to import fixed-field data into MySQL. I could use Microsoft Access to import it, then export it as a tab-delimited ASCII file to then be imported into MySQL. However, my IT shop is seeking an open source solution. Is there an open source utility that allows the importing of fixed-field (or column de-limited) data into MySQL?

    Requires Free Membership to View

MySQL can read fixed-width and de-limited files directly using the LOAD DATA INFILE command. The LOAD DATA INFILE command can be used to read data files located on either the server or the client (with the LOAD DATA LOCAL INFILE syntax), using any delimiters you specify or fixed-width.

The full syntax of LOAD DATA INFILE is available here. This is one example of reading a comma-delimited file:

LOAD DATA INFILE 'data.txt' INTO TABLE tbl_name

LOAD DATA INFILE is generally quite fast. In my experience, I have seen it load three million rows in roughly ten seconds.

This was first published in May 2006

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: