Forum Moderators: coopster & phranque

Message Too Old, No Replies

mysqlimport syntax questions

         

Trisha

11:36 pm on Apr 5, 2003 (gmt 0)

10+ Year Member



I've been trying to import a tab delimited file into a MySQL database (http://www.webmasterworld.com/forum13/2396.htm). 'Load data infile' has been disabled by my host and I don't have any shell access. I found information about mysqlimport at the mysql.com site.

It says to do it like this:
shell> mysqlimport [options] database textfile1 [textfile2 ...]

First - can I even use mysqlimport through the section: 'Run SQL query/queries on database' in phpMyAdmin?

Second - where it says 'database' does it mean to literally leave in the word 'database'? Or to replace it with the name of the database I'm using?

When using either:
mysqlimport database data_feed.txt
or
mysqlimport database_name data_feed.txt

I get the error:
You have an error in your SQL syntax near 'mysqlimport database data_feed.txt' at line 1

Fischerlaender

10:02 am on Apr 6, 2003 (gmt 0)

10+ Year Member



The syntax is something like
mysqlimport -L -u dbusername -h dbhostname -p dbname datafile.txt

dbusername, dbhostname and dbname have to be replaced by the values you got from your ISP.

datafile must match the table name you are importing to. If you want to import into table 'data123', the your data file must be named something like data123.txt - the extension is not important, but the part before the first dot is.

-L tells mysql, that the data file is located on your local file system and not in the servers file system.

But if LOAD DATA is diabled I think that your chances are small that mysqlimport will work, because mysqlimport is just an interface to the LOAD DATA functionality.

Trisha

1:12 am on Apr 11, 2003 (gmt 0)

10+ Year Member



Thanks, I'll try that. I asked my host about mysqlimport and he didn't seem to know what it was, so I don't know if it is likely to be disabled or not.