[mod_python] Newbie Connection Problems

Joshua Cohen JoshC at usracmfg.com
Fri Jul 1 14:14:28 EDT 2005


Hi Everyone, 

I have been programming in Python for a while now but am new to the mod_python module. I am having problems connecting to a MySQL database using MySQLdb. The database is 4.0.24 and is located on a Windows 2000 server. I am running a Fedora Core 4 PC with Apache 2/Python2.4.1 I have no issues with running a simple test script against mod_python in Apache, all is well. However, when I try to import MySQLdb and create a simple database connection I receive an error

OperationalError: (2003, "Can't connect to MySQL server on 'IPADDRESSHIDDEN' (13)")

The code is very simple and is as follows:

import MySQLdb

def sql():
     db_connection = MySQLdb.connect(host="IPADDRESS", user="user", passwd="password", db="database", port=3306)


There is no reason for me to go further with the code since I cannot even establish an connection to the DB. If I execute the same basic lines through a prompt, I am able to connect to the DB and query without any issues. 

Any ideas what is going wrong? I've waisted away enough of my life searching google for a solution. 

Thanks,

Josh




More information about the Mod_python mailing list