August 8th, 2000, 11:40 AM
-
hi there...
trying to get a mysqlimport working here...Driving me nuts!
using : mysqlimport -u root -p -fields-enclosed-by=, -fields-optionally-terminated-by=" DB c:/brand.txt;
this keeps returning :
mysqlimport: invalid option -- e
--e????@?!?!?!?!! wtf
im really lost here....from all the sources i've checked, this syntax is correct! is there any other steps i might be missing????
thks
cryogen
------------------
i'm trying...REALLY!
[This message has been edited by cryogen (edited August 08, 2000).]
August 8th, 2000, 02:01 PM
-
I believe this should be
mysqlimport -u root -p --fields-enclosed-by=, --fields-optionally-terminated-by=" DB c:/brand.txt;
(notice the "--" in front of the multi-word arguments)
NOW... the real question: why are you 'optionally' terminating your fields by quotes? I've never heard of fields being _optionally_ terminated by anything, but often fields with text content are optionally _enclosed_ by quotes, before the field terminator.
Maybe you should try:
mysqlimport -u root -p --fields-optionally-enclosed-by=" --fields-terminated-by=, DB c:/brand.txt;
Are you importing an Access table? If so, there is an excellent utility to convert a whole Access database to SQL script that will run in MySQL to recreate that database. (http://download.sourceforge.net/mirrors/mysql/Contrib/exportsql.txt)
Also look at http://www.mysql.com/downloads/contrib.html#SEC466 for some other conversion utilities.
August 9th, 2000, 08:57 AM
-
hrm....the optionally terminated was a typo :| hehe
however, the command you posted still does nothing, i type in:
mysqlimport -u root -p --fields-optionally-enclosed-by=" --fields-terminated-by=, DB c:/brand.txt;
and all i get is the information screen!
grrrrrrrrrrr
cryogen
August 9th, 2000, 12:38 PM
-
I haven't had a chance to use mysqlimport lately, but I think your problem might be that you need to enclose your separator characters with single quotes as in
--fields-optionally-enclosed-by='"' --fields-terminated-by=',' etc....
Also, I assume that since your textfile is brand.txt, that the table you are loading into is called 'brand'. You probably know this, but in mysqlimport strips the extension of the filename and uses the filename as the tablename.
Other than that, I don't know what the problem could be, but one nice solution is to use phpMyAdmin, (get it at www.phpwizard.net ), a web-based MySQL admin kit using PHP, that lets you import and export data easily.