Unanswered: load text file into database (was "Need help")
I have installed MYSQL SERVER and having problem to load a textfile in the DATABASE.
I have a text file called 'pet' and using the following command.
mysql> LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet;
As my test file is in Destkop i am using the following path.
mysql> LOAD DATA LOCAL INFILE '/C:\Documents and Settings\rkhanal\Desktop\pet.txt INTO TABLE pet;
'> Lines TERNINATED BY '\n'; //--> Tells me " Unknown command '\n'.//
So the problem is why this line ('>) coming in the screen?
What does that mean? What should i put in there?
How do i see( What command i should use) that this text file is loaded in to my MYSQL database?
Tom Ran Dog M 1993-02-04 \N
CHuney Eva Dog F 1994-03-17 1993-02-04
Slim Terry Cat M 1990-08-27 1986-03-05
White John mouse F 1996-04-29 \N
Slim Benny snake m 1996-04-29 1996-05-02
Bowser Diane dog m 1979-08-31 1995-07-29
mysql> LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet LINES TERMINATED BY '\r\n';
the semi colon separates / temrinates a SQL LINE, so MySQL isn;t picking up the 'lines terminated by...'
you also need to be consistent.. ie make sure every line is terminated by \N
you also need to be precise, MySQL is case sensitive so you need to make sure your lines are terminated with the same character as you've told it \N, not \n
you also need tomake sure your columns are separated by tabs.. im not sure these are
Now that i am albe to move on a bit from where i was. But then again i don't know the command to see the loaded text table in to the MYSQL database. Can anyone help me what command should i type to see the loaded text table in the database.