Re: MySQL and Korn Shell

From: Frye, Matthew (Matthew.Frye@REXHEALTH.COM)
Date: Fri Aug 15 2003 - 10:03:36 EDT


Darryl,
        I have had success with the following methods:

1) mysql -u username -p password -e "you sql goes here" >
where_you_want_output
2) mysql -u username -p password < pre-written_sql_script.sql >
where_you_want_output

        Of course, the password requirement depends on how you have
security/access set up, and the output to a file is optional, depending on
your needs. I regularly use these methods for extracting information from a
database to provide notifications, etc. The output formatting is slightly
different between the two methods, but they allow for off-the-cuff or
pre-set queries to be executed quite flexibly.

Matt Frye
Sr. Systems Programmer, RS/6000 Group
Rex Healthcare
(919) 784-3791

> ----------
> From: Darryl Ousterhout[SMTP:D.Ousterhout@LABSAFETY.COM]
> Reply To: IBM AIX Discussion List
> Sent: Wednesday, August 13, 2003 2:39 PM
> To: aix-l@Princeton.EDU
> Subject: MySQL and Korn Shell
>
> Admins,
>
> Are any of you using MySql in any or your Korn shell scripts? I was just
> wondering what the syntax was to invoke MySql commands from a script.
>
> Thanks in advance,
>
> Darryl
>



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:08 EDT