I'm a little rusty, and I've never used mysql, so hopefully I won't lead you too far astray. I'm not sure if the output from mysql is normally standard out or error out, or a combination of the two, but if it's standard out, all you need is a greater-than sign followed by the file name. For example:
Quote:
|
> mysql -utest -ptest -htesthost testdb -e -e "select * from student;" > log_file
|
If the output is error out, use 2 greater-than, like this:
Quote:
|
> mysql -utest -ptest -htesthost testdb -e -e "select * from student;" 2> log_file
|
If the output is both, then redirect standard out to the file, and then redirect error out into standard out, like this:
Quote:
|
> mysql -utest -ptest -htesthost testdb -e -e "select * from student;" > log_file 2>&1
|
Just looked up mysql commands online. Looks like you could possibly use "-tee=log_file" as an option and let mysql handle it for you. If you don't want the result to come out on the screen, you can redirect it to oblivion like this:
Quote:
|
> mysql -tee=log_file -utest -ptest -htesthost testdb -e -e "select * from student;" > /dev/null 2>&1
|
I hope I haven't confused the issue too much.
Wayne