Question about MySQLdb, OS X 10.5, and authentication

Posted by timpone on Stack Overflow See other posts from Stack Overflow or by timpone
Published on 2010-06-10T02:21:46Z Indexed on 2010/06/10 2:32 UTC
Read the original article Hit count: 410

Filed under:
|

I'm a noob at Python and have been having problems with MySQLdb and OS X Leopard 10.5. I have a php app that is doing db access just fine with pdo but also want to access with Python. When I use the same credentials with MySQLdb as php, I get the following error:

  File "build/bdist.macosx-10.5-i386/egg/MySQLdb/connections.py", line 188, in __init__
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'arc_db'@'localhost' (using password: YES)")

The authentication piece works fine on my ubuntu server (installed via apt-get) implying that it is something specific to my OS X MySQLdb install.

Looking at some postings, I thought it would be my local build of MySQLdb which seems to be problematic with OS X. But I am able to import fine:

Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>> 

Also, wanting to create a positive, I am able to access and return results from a database tilted test_something (which presumably bypasses the MySQL's authtentication - not sure exactly how though). Trying to figure out a little more what is going on, I turn on logging for mysql and get the following (added my own comments):

100609 19:09:45       3 Connect     Access denied for user 'arc_db'@'localhost' (using password: YES) //not worked
100609 19:10:02       4 Connect     arc_db@localhost on arc_development //did work

I'm not really sure what the 3 or 4 means but presumably a sucess or failue.

So, I guess what would be the next step? Am I doing some obvious stupid python mistake (very likely)? Is there a better way for me to prove that this should / can be working? Is there any way to determine what MySQLdb is sending exactly in its authentication message to MySQL?

thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about mysqldb