Importing with phpMyAdmin

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I want to import a csv file into my table. However, I need to empty
the table before I do this. The problem is, I only see an option to
"replace" the data. Is there a way to empty a table AND simultaneously
import a csv? I know this is possible with the mysqlimport command
(with the --delete argument), but I'm not if it's possible in

I'm using phpMyAdmin and MySQL 4.1.10


Re: Importing with phpMyAdmin

Toine wrote:
Quoted text here. Click to load it

This is more of a PHP question...

PMA's import function is for MySQL formatted data, not CSV.

Not sure about this "replace data" option to which you refer.  It does
not exist in the import window.

To import CSV files you'd be using the SQL window, so you'd need two
lines in the query:

TRUNCATE <table>;

Replace <table> with the target table, and <file.csv> with the name of
your import file.

Note this may not work if you're on a shared host; you can't just point
PMA to a file on your local system & hope it will magically import up to
the server.

    Re-format the CSV code into MySQL format, pre-pend a TRUNCATE statement
into the query, and use PMA's Import feature.

    Write your own script to do the import, have it check IP to keep
malicious users from accessing it, and just bookmark it in your browser.

Site Timeline