0

I'm trying to install MYSQLdb on a windows client. The goal is, from the Windows client, run a python script that connects to a MySQL server on a LINUX client. Looking at the setup code (and based on the errors I am getting when I try to run setup.py for mysqldb, it appears that I have to have my own version of MySQL on the windows box. Is there a way (perhaps another module) that will let me accomplish this? I need to have people on multiple boxes run a script that will interact with a MySQL database on a central server.

3 Answers 3

1

you could use a pure python implementation of the mysql client like

  • pymysql (can be used as a dropin-replacement for MySQLdb by calling pymysql.install_as_MySQLdb())
  • MySql-Connector
Sign up to request clarification or add additional context in comments.

2 Comments

MySql-Connector will run by itself and not require any local MySQL libraries?
Yes, both libraries run without need for the mysql libraries to be installed. They're also supported by sqlalchemy as dialects.
1

You don't need the entire MySQL database server, only the MySQL client libraries.

3 Comments

Which client libraries would I need? I tried downloading them but they didn't work. I double-checked and I ended up downloading the on for C code. I don't see one for python. I'm looking here, which might not be the right spot? dev.mysql.com/downloads/connector
The C connector is the correct choice. You need to point the linker at the .lib files so it can't link against the DLL.
'setup.py install' still failed with that connector installed. It's looking for registry entries that this connector does not seem to be installing.
0

It's been a long time since I wrote python db code for windows...but I think something like this should still work.

If you're running the client only on windows machines, install the pywin32 package. This should have an odbc module in it.

Using the windows control / management tools, create an odbc entry for either the user or the system. In that entry, you'll give the connection parameter set a unique name, then select the driver (in this case MySQL), and populate the connection parameters (e.g. host name, etc.) See PyWin32 Documentation for some notes on the odbc module in pywin32.

Also, see this post: Common ways to connect to odbc from python on windows.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.