The way I usually do it is this..

I have a shell scipt called "query"

It contains:

/fullpath/mysql  --user=root --password=xxxxxxxx Database_Name

I then make new scripts for the queries as such:

(query file name: Select_all.sql)

Select * from Table where blah=foo;

To run this I then execute the command

./query < Select_all.sql

This outputs the results to the standard out.

You could also

./query < Select_all.sql > /tmp/some_output_file

Hope this helps.

Jeff

> -----Original Message-----
> From: Mike Tuller [mailto:[EMAIL PROTECTED] 
> Sent: Friday, October 10, 2003 1:07 PM
> To: [EMAIL PROTECTED]
> Subject: Shell Script to Insert Data
> 
> 
> I am trying to create a script that will insert data. Right 
> now I am just using something simple to test this out, but I 
> can't get it to work. Here is what I have.
> 
> mysql  --user=root --password=xxxxxxxx Database_Name;
> INSERT INTO table_name (column_name) VALUES ("value");
> 
> After I run the script, I check the data, and nothing was 
> entered. When I run each statement on it's own (not from a 
> script file, but in the shell) Everything seems to work. It 
> just doesn't work when you try to run it from a script.
> 
> Any ideas?
> 
> Mike Tuller
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/mysql?> [EMAIL PROTECTED]
> 
> 

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to