If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Noob... "Insert Data To MySQL"

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-17-06, 22:53
moon47usaco moon47usaco is offline
Registered User
 
Join Date: Sep 2006
Posts: 3
Noob... "Insert Data To MySQL"

Trying to fallow this tutorial to learn mysql...

http://www.php-mysql-tutorial.com/my...data-mysql.php

Ran into a snag...

Running this command from terminal....

Quote:
Macintosh:~ ryanmooney$ mysql < /insert.txt
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Bird
Fish
Turtle' at line 1
Insert text is just a plain textfile with 3 lines of text each proceded by a tab (i have tried without the tab too)...

insert.txt: >>>
Quote:
Bird
Fish
Turtle
Reply With Quote
  #2 (permalink)  
Old 09-17-06, 23:00
dbmab dbmab is offline
Registered User
 
Join Date: Apr 2006
Location: Denver, Co. USA
Posts: 240
The text file must contain valid sql statements. The three lines - Bird, Fish, Turtle are not sql statements and have no meaning to mysql. If your file contains something like the following, it should work -
Code:
INSERT INTO species (name) values ('Bird');
INSERT INTO species (name) values ('Fish');
INSERT INTO species (name) values ('Turtle');
Reply With Quote
  #3 (permalink)  
Old 09-17-06, 23:29
moon47usaco moon47usaco is offline
Registered User
 
Join Date: Sep 2006
Posts: 3
Thanks,

Got it...

I have seen allot of errors in that tutorial already...

Like
Quote:
INSERT INTO species (name) values ('Turtle');
Should really be
Quote:
INSERT INTO species (species) values ('Turtle');
By means of
Quote:
mysql> CREATE TABLE species (id INT NOT NULL AUTO_INCREMENT, species varchar(30) NOT NULL, primary key(id));
Query OK, 0 rows affected (0.02 sec)
Yes/No...

Any way got to learn the bassics somewhere and what better way than from error and trial and error and.... Anyway...

Thanks for the direction... =]
Reply With Quote
  #4 (permalink)  
Old 09-18-06, 00:00
dbmab dbmab is offline
Registered User
 
Join Date: Apr 2006
Location: Denver, Co. USA
Posts: 240
The least error prone version of the information on that web site is available in the mysql documentation. Here is a link to the Tutorial in the manual - http://dev.mysql.com/doc/refman/5.0/en/tutorial.html Section 3.3 and 3.6 are the most useful.

I recommend downloading a version of the manual for reference - http://dev.mysql.com/doc/ I personally use the Windows CHM version. The "INDEX" tab makes finding information fairly easy.
Reply With Quote
  #5 (permalink)  
Old 09-19-06, 03:22
Pihzawwut Pihzawwut is offline
Registered User
 
Join Date: Sep 2006
Location: USA
Posts: 1
It is really??
Reply With Quote
  #6 (permalink)  
Old 10-02-06, 16:29
moon47usaco moon47usaco is offline
Registered User
 
Join Date: Sep 2006
Posts: 3
Quote:
It is really??
Is it really what... ??

If you are referring to weather it is the "least error prone" i would say YES i have been flowing the section 3 tutorial and have run in to no hiccups here on mac os x using the command line terminal...

With the exception of "LOAD DATA LOCAL INFILE" not working on my apache web server if you continue to read and fallow the link about "Security Issues with LOAD DATA LOCAL" i found that i do not use LOCAL with apache...

Definitely a good reference material with a good easy to use and understand structure and the user comment section is invaluable and should be used by more reference/tutorial sites because if one person has an answer to something most likely there are many others that will benefit from user input...

Welcoming myself to the world of MySQL could not be easier...

Thanks "dbmab"... =]
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On