Thread: mysqlimport

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    halifax
    Posts
    13
    Rep Power
    0
    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).]
  2. #2
  3. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    61
    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.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    halifax
    Posts
    13
    Rep Power
    0
    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
  6. #4
  7. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    61
    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.

Similar Threads

  1. mysqlimport
    By pocon in forum MySQL Help
    Replies: 0
    Last Post: March 10th, 2003, 10:17 AM
  2. Enable mysqlimport
    By pocon in forum MySQL Help
    Replies: 0
    Last Post: March 5th, 2003, 03:08 PM
  3. mysqlimport problem
    By amidude in forum MySQL Help
    Replies: 1
    Last Post: October 30th, 2002, 11:16 PM
  4. mysqlimport
    By da_gimp in forum MySQL Help
    Replies: 4
    Last Post: August 14th, 2001, 01:45 AM
  5. mysqlimport mysteriously fails
    By jimp123 in forum MySQL Help
    Replies: 2
    Last Post: February 23rd, 2001, 12:17 PM

IMN logo majestic logo threadwatch logo seochat tools logo