[Tutor] connect to a remote machine - Linux

Python python at venix.com
Mon Jun 12 00:48:50 CEST 2006


On Sun, 2006-06-11 at 15:19 +0000, Patricia wrote:
> Hi All,
> 
> I need to connect to a remote computer on the same network to store data into 
> its mysql database, and I need to do this using python script.
> 
> Although I've used mysql and python before, I have no idea how to access a 
> remote computer with Python. Also, I would have to enter a passphrase and 
> password to successfully connect to it.. 

I could not simply cut and paste working code, but this should get you
started.  There is no programming difference in using a remote sql
server.

import MySQLdb

dbparms = { 
    'host':'dbserver.example.com',  # name of sql server
		  		    # (localhost for your local computer)
    'user':'dbusername',	# your identifier
    'passwd':'dbpassword',	# your password
    'db':'dbname_to_use',	# initial database
    }
conn = MySQLdb.connect( **dbparms)


> 
> I'd appreciate any help.
> Thanks!!
> 
> Patricia
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
-- 
Lloyd Kvam
Venix Corp



More information about the Tutor mailing list