At 0:34 +0100 9/4/03, Neil Belch wrote:
>Hi all, new to the list and new to mySQL...
>
>I've only been at it for a few days and am looking at importing text
>files to databases.
>I'm having trouble with mysqlimport and would appreciate any help or
>solutions as to what I'm doing wrong - I'm sure its a dumb mistake!
>
>I tried LOAD DATA INFILE and it worked fine. Here's the code I used for it:
>
>LOAD DATA LOCAL INFILE 'master_name.txt'
>INTO TABLE master_name
>FIELDS TERMINATED BY ':::'
>ENCLOSED BY '"'
>LINES TERMINATED BY '\r\n'
>
>This works fine. Every record is in the table and all the data is in there.
>
>
>When I try the same thing with mysqlimport, the records are there
>but there's no data in any of the fields!
>The code I used for it:
>
>mysqlimport -L -h localhost -u supercontact -ppassword
>--fields-terminated-by=::: --fields-enclosed-by=\"
>--lines-terminated-by=\r\n contactDB master_name.txt
>
>However, that whole command above won't fit on the DOS prompt in one
>go, so I have to enter most of the options in one command, then the
>remaining ones along with the db name and txt file in a second
>command - it seems to work as the records are still added but
>there's no data.
Eh? That can't work; you must enter all the arguments in a *single* command.
You may be able to shorten the command by omitting -h localhost, it
should default to the local host anyway. Or you could put options in
an option file such as C:\my.cnf:
[mysqlimport]
local
host=localhost
user=supercontact
fields-terminated-by=:::
etc.
Of course, if you don't want to use those options the next time you
run mysqlimport, you'll need to remove them from the option file.
>(On another note, is there a way to fit the command onto one line in
>the DOS prompt?)
>
>Any help is greatly appreciated.
>Thanks,
>
>
>Neil Belch
--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
Are you MySQL certified? http://www.mysql.com/certification/