[mythtv-users] How to automate a mysql script with a password protected database?

StewBeast stewbeast at nc.rr.com
Thu Apr 1 10:22:24 EST 2004


The following is how I would do it with BASH (sorry) ... just translate 
SYNTAX to your requirement


db="mythconverg"
userid="****"
passwd="****"
MYSQL="mysql --disable-pager --batch -u$userid -p$passwd $db"
SQL="select chanid, starttime, endtime, title, subtitle from recorded 
order by starttime;"

$MYSQL  << EOQ
$SQL
EOQ

William wrote:

>I am trying to automate a script to create mpg symlinks to recordings. My
>sql database requires a password and I am trying to include the password in
>the script rather than entering it by hand each time I run the script. Here
>is the part of the script that pulls the data from mysql.
>
>----------
># Command to return the sql rows. Must have -N !!A 
>$MYSQL="mysql -N -u root -p mythconverg"; 
>$SQL="select chanid, starttime, endtime, title, subtitle from recorded order
>by starttime"; 
>
>$data=`echo $SQL | $MYSQL`; 
>----------
>I have tried various things like
>-p mypass
>-p 'mypass'
>
>etc but no joy. I am hoping someone with more sql background can point me in
>the right direction.
>
>TIA,
>
>Bill
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>mythtv-users mailing list
>mythtv-users at mythtv.org
>http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20040401/9140df29/attachment.html


More information about the mythtv-users mailing list