Unix Programming - Unix Shell script and MYSql

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > June 2005 > Unix Shell script and MYSql





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Unix Shell script and MYSql
jzz

2005-06-29, 2:48 am

I want to use a unix shell script that interacts with a mysql database
and executes queries on the database.

Is this possible? If so , How??

BYe
jZZ

SM Ryan

2005-06-29, 2:48 am

"jzz" <yojo101@hotmail.com> wrote:
# I want to use a unix shell script that interacts with a mysql database
# and executes queries on the database.

@ msq 'select * from config where name="thumbnaillength"' | od -xc
0000000 6e61 6d65 0976 616c 7565 0a74 6875 6d62
n a m e \t v a l u e \n t h u m b
0000020 6e61 696c 6c65 6e67 7468 0939 300a
n a i l l e n g t h \t 9 0 \n
0000036

# Is this possible? If so , How??

msq happens to be script in my ~/bin

#!/bin/sh
if [ $# -gt 0 ]
then
/usr/local/mysql/bin/mysql -uuser -ppassword -Ddatabase -B -e "$1"
else
/usr/local/mysql/bin/mysql -uuser -ppassword -Ddatabase
fi
exit 0

You can pass the output through other unix tools like awk.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
God's a skeeball fanatic.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com