Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-26-2009, 11:24 PM   #1
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
unable to insert data into the table

hi all....

when i try to insert a row into the table user in mysql database using following command in shell script i am getting error as Unknown column 'localhost' in 'field list'

command that iam using:
'insert into user(Host,User,Password)values('localhost','vin','vin');'

if i try to insert manually using above command it is working fine..why is it so ..can anyone please help me...??

Thanks in advance....
Old 04-27-2009, 12:37 AM   #2
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

'insert into user(Host,User,Password)values('localhost','vin','vin');'
is being interpreted by the shell as something like this:
'insert into user(Host,User,Password)values('
I'm oversimplifying just a bit ... but the point is, I suspect your problem is with the single quotes. Google for "shell" and "metacharacters".

If my hunch is correct, it should probably work if you wrapped the whole statement in double-quotes instead:
"insert into user(Host,User,Password)values('localhost','vin','vin');"
'Hope that helps .. PSM
Old 04-27-2009, 01:44 AM   #3
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Original Poster
Rep: Reputation: 55
hi paulsm4...

U are absolutely correct....

its working ...thanks a lotttt.......



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I INSERT IGNORE the current date into a table in MYSQL? resetreset Programming 9 12-15-2008 01:39 AM
Howto insert a pdf document into a mysql table jadewarrior Linux - Server 4 02-23-2007 05:18 AM
Abiword --- Can't insert picture in table cell rickh Linux - Software 2 03-07-2006 12:53 PM
How to insert same text in one field for 10,000 records table edhan Linux - Newbie 6 06-13-2005 03:48 AM
Mysql - Howto insert 'admin' account into table ??? b:z Linux - General 6 03-29-2005 03:44 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration