Python – How to use MySQLdb when MySQL Isn’t Installed Locally
Monday, November 21st, 2011It turns out there’s a new MySQL connection library called MySQL Connector.
I installed it and then I just imported that into my script and everything else seemed to work normally. At least for my simply import script.
import mysql.connector as MySQLdb
I believe this library is designed for those who want to connect to MySQL on another server. It doesn’t seem to require any MySQL libraries to be installed.
When I tried to install mySQLdb it complained with the following message. I’m guessing the problem was that it requires MySQL to be installed:
File "/Users/pinerog/Downloads/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found