 |
 |
 |
 |
| Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum. |

28th February 2007, 12:24 AM
|
|
Registered User
|
|
Join Date: Mar 2005
Location: Terre Haute, IN
Posts: 254

|
|
|
mysql bash insert error?
Any suggestions on this?
Code:
[root@localhost ~]# mysql -u root -p pass12345 < "insert into temps.garage(datestamp,system,hd) values(now(),'40','40');"
bash: insert into temps.garage(datestamp,system,hd) values(now(),'40','40');: No such file or directory
[root@localhost ~]#
Thanks!
__________________
F18
|

28th February 2007, 12:32 AM
|
 |
Registered User
|
|
Join Date: Nov 2006
Posts: 192

|
|
|
For stuff like that you probably want to use the '-e' command (execute command).
|

28th February 2007, 12:35 AM
|
 |
Registered User
|
|
Join Date: Mar 2006
Location: Land of the "free"
Posts: 128

|
|
Code:
mysql -u root --password=yourpassword yourdb <<EOF
INSERT INTO table_name VALUES ('some_data');
INSERT INTO table_name VALUES ('some_data');
EOF
or I think you can pipe into mysql as well
echo "INSERT INTO table_name VALUES ('some_data');" | mysql -u root --password=yourpassword yourdb
|

28th February 2007, 12:35 AM
|
|
Registered User
|
|
Join Date: Mar 2005
Location: Terre Haute, IN
Posts: 254

|
|
Thanks,
Code:
[root@localhost ~]# mysql -u root -p pass12345 -e < "exec insert into temps.garage(datestamp,system,hd) values(now(),'40','40');"
bash: exec insert into temps.garage(datestamp,system,hd) values(now(),'40','40');: No such file or directory
[root@localhost ~]# mysql -u root -p pass12345 -e < "insert into temps.garage(datestamp,system,hd) values(now(),'40','40');"
bash: insert into temps.garage(datestamp,system,hd) values(now(),'40','40');: No such file or directory
[root@localhost ~]#
__________________
F18
|

28th February 2007, 12:43 AM
|
|
Registered User
|
|
Join Date: Mar 2005
Location: Terre Haute, IN
Posts: 254

|
|
|
moose, thanks, piping worked great!
__________________
F18
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 18:40 (Tuesday, 21-05-2013)
|
|
 |
 |
 |
 |
|
|