By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,035 Members | 1,984 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,035 IT Pros & Developers. It's quick & easy.

Mysqldb install on Windows 2003 Server, talking to a Linux Box

P: 5
Hello,

I am trying to get python on a Windows 2003 server to talk to a mysql install on linux. I used the MySQL-python-1.2.2.win32-py2.5.exe installer but am not sure how to set up the mysqlroot environment variable to point to the external host, or if there's anything else I need to do to get this to work.

Thank you!
May 18 '07 #1
Share this Question
Share on Google+
6 Replies


bartonc
Expert 5K+
P: 6,596
Hello,

I am trying to get python on a Windows 2003 server to talk to a mysql install on linux. I used the MySQL-python-1.2.2.win32-py2.5.exe installer but am not sure how to set up the mysqlroot environment variable to point to the external host, or if there's anything else I need to do to get this to work.

Thank you!
Let's start out by seeing if you can connect: Depending on you network connection server can be refered to by name or ip address (also in quotes).
Expand|Select|Wrap|Line Numbers
  1. from MySQLdb import *
  2.  
  3.  
  4. dbconnect = connect(host='genesis', user='barton', passwd='xxxpasswordxxx')
  5. dbconnect.close()
  6.  
Of course, my host and user names will not work for you, but you should get the picture.
May 18 '07 #2

P: 5
Actually, this appeared to work (no errors; command prompt simply returned).

fyi, what i have as an env variable on the windows server is:
<fqdn>:/usr/bin/mysql

with the name of the variable name set to 'mysqlroot'

Maybe that is right, defying all odds!

I will try to do some data manipulation and if all goes kablooey will write back to this forum--unless you can see from what I've written above that I'm doing something wrong. Thank you very much!
May 18 '07 #3

bartonc
Expert 5K+
P: 6,596
Actually, this appeared to work (no errors; command prompt simply returned).

fyi, what i have as an env variable on the windows server is:
<fqdn>:/usr/bin/mysql

with the name of the variable name set to 'mysqlroot'

Maybe that is right, defying all odds!

I will try to do some data manipulation and if all goes kablooey will write back to this forum--unless you can see from what I've written above that I'm doing something wrong. Thank you very much!
You are quite welcome. That's what the Python forum on TheScripts.com is here for.
There are ways to tell MySQLdb.connect where to look for login info, but it's not going to try to read any env variables on it's own. The best documentation for MySQLdb is in the .py file by the same name (should be in site-packages).
May 18 '07 #4

P: 5
Follow-up: I'm in! Thank you. Everything looks great.

Changing the envinroment variable to garbage had no effect, so I guess the installer had done that work for me but I was doing something else wrong that masked it.

Thanks again.
May 18 '07 #5

P: 5
I posted my last before reading yours so see what you say about env vars which matches my experience.

I'm manipulating data now so am all set.
Thank you!
May 18 '07 #6

bartonc
Expert 5K+
P: 6,596
I posted my last before reading yours so see what you say about env vars which matches my experience.

I'm manipulating data now so am all set.
Thank you!
Any time, really....
May 18 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.