I have a small script that connects using ssh and opens a tunnel on port 3306. It works in the ipython interpreter if i type it in manually. However when I try to run the script from the interpreter or command line I get the error message "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)". tmp/mysql.sock does exist.
the code is below:
command = '/usr/bin/ssh firstname.lastname@example.org -i mykey -p 1022 -L 3306:localhost:3306 -N'
conn=MySQLdb.connect(host='aname',user='me',passwd='yes', db='probably', port=3306)
** from the Ipython interpreter i can do a fetchall or any other mysql commands and it works fine, but if i'm running the script it stops after the 'conn=...'
I'm guessing a permissions issue although i've tried running the script with a sudo and it still fails.
This is on Mac OS 10.5.8