MySQLdb not reading ~/.my.cnf ?
Mike Orr
iron at mso.oz.net
Wed Jul 11 16:08:37 EDT 2001
Dennis Schoen <dennis at cobolt.net> wrote:
> I'm trying to connect to a mysql db from a python script. I can
> connect without any problem when i add explicitly the username and
> passwd like this:
> db = MySQLdb.connect(db=sys.argv[1], user=sys.argv[2], passwd=sys.argv[3])
> coming from perl I like the idea of ~/my.cnf, but when i just ommit the
> parameters I get:
> _mysql_exceptions.OperationalError: (1045, "Access denied for user: 'dennis at localhost' (Using password: NO)")
> My ~/my.cnf file works fine, when used from other applications.
Apparently, reading ~/.my.cnf is the responsibility of the application or
library, and MySQLdb doesn't do it. It could, of course. Perhaps as
an option to MySQLdb.connect(read_password_from_mycnf=0) or if
passwd is None....
--
-Mike (Iron) Orr, iron at mso.oz.net (if mail problems: mso at jimpick.com)
http://iron.cx/ English * Esperanto * Russkiy * Deutsch * Espan~ol
More information about the Python-list
mailing list