Conexión a MySQL a través de Python MySqlDb (error 1045)

I am using Python 2.7 on OSX Lion and can't connect to a remote SQL Db on Python. I get the following error:

Traceback (most recent call last):
  File "connectDB.py", line 39, in <module>
    main()
  File "connectDB.py", line 16, in main
    db = MySQLdb.connect(HOST, USER, PASSWORD, DBNAME )
  File "build/bdist.macosx-10.7-intel/egg/MySQLdb/__init__.py", line 81, in Connect
  File "build/bdist.macosx-10.7-intel/egg/MySQLdb/connections.py", line 187, in __init__
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'ekogan'@'dyn-209-2-217-168.dyn.columbia.edu' (using password: YES)")

I know my host and user/pass work because I'm able to access it via PHP. But for some reason it's denied here. Could there be some SQL versioning issues? I am totally unsure of how to proceed.

preguntado el 30 de enero de 12 a las 19:01

3 Respuestas

PHP probably does not access your MySQL server as a sanaciones host. Python probably does. So check your permissions.

Respondido el 30 de enero de 12 a las 23:01

yes, i just contacted my admin and he confirmed none of us can access remotely. thanks for the info. - genekogan

If you have permission to inspect the mysql.user table, open a terminal and type

% mysql -u ekogan -p mysql
mysql> select user, host, password from user where password = password(PASSWORD);

Above, change PASSWORD to the value of your password surrounded by quotes, (i.e. if your password is foobar, El cambio PASSWORD a "foobar"). The user, host and password must match an entry in the mysql.user mesa.

Respondido el 31 de enero de 12 a las 01:01

grant select,update,delete,insert on DBNAME.*  to  'ekogan'@'dyn-209-2-217-168.dyn.columbia.edu' identified by 'PASSWORD'; 

Respondido el 24 de Septiembre de 13 a las 10:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.