View Full Version : Help loading tables
I am having a hard time trying to get flat file data
_DATA_
3:2:Bill:74323:cl65@home.com::::::::::::::::::::::::
into sql tables
load data local infile "data.txt"
[nbsp]into table userfile
[nbsp]fields enclosed by "\:"
[nbsp]lines terminated by "\n";
Suggestions please.
BTW, newbie to MySQL, too.
JW.
Justin
04-09-2001, 11:34 AM
Your databases are hosted on a different physical machine from the one you telnet in to. Thus, load...infile and select...outfile will not work.
You will want to look into 'mysqlimport', which will do what you need. Type 'man mysqlimport' for help, or check out the MySQL documentation for more information.
Hope this helps.
------------------
Justin Nelson
SFE Software (http://www.sfesoftware.com)
A bit too brief for me, consider my age an ability to absorb some of this stuff.
I've read the mysqlimport. Tried that with many combinations, and still can't get it done.
mysqlimport
--fields-enclosed-by=\:
[nbsp]--lines-terminated-by=\n
db-name_2 file.txt
[nbsp];
I've tried quoting the \:, tried without the escape, with the \n quoted. I've tried the full path name to the file on Futurequest.
Very frustrated.
JW.
still trying.
[This message has been edited by JW (edited 04-09-01@10:00 pm)]
Justin
04-10-2001, 06:16 AM
What is the error message (or other symptom) you are receiving? It's hard to say what's wrong without a bit more information.
Keep in mind that, just like any other MySQL command line tool, you need to specify the login name, password, and MySQL hostname. For example:
</font><font face="Courier" size="3">
mysqlimport -uxdomain -p -hmysql.yourdomain.com --fields-enclosed-by=\: --lines-terminated-by=\n db-name_2 file.txt
</font><font face="Verdana, Arial" size="2">
Also keep in mind that this all would be entered on one line (I realize you probably broke the line up for display purposes, but just in case...) and that this is to be used from your shell login, *not* from your MySQL login.
Hope this helps, but if not, it would help to paste the exact error message (or other info) you are receiving.
------------------
Justin Nelson
SFE Software (http://www.sfesoftware.com)
Thanks. It was a lack of understanding of what I was doing. I got the command line part down. It was a matter of connecting.
Sometime ago, I had done some playing around with MySQL, and done the LOAD INFILE, and mysqlimport. The connect part of it was not even in my realm of consideration - DUH!
Got it done.
Thanks for the time.
JW.
vBulletin® v3.6.8, Copyright ©2000-2009, Jelsoft Enterprises Ltd.