[pyar] _mysql_exceptions.OperationalError: (1045, "Access denied for user

Hamilton Kajak flomanav en yahoo.com
Lun Ago 27 00:21:59 ART 2012


Entorno: Ubuntu 12.04 Python 2.7.3 Django 1.4.0


Es probable que alguno haya tenido este problema. No encontré nada parecido en la lista de correo y gugliando encontre este problema con otras versiones de software y en la mayoria de los casos correspondían a errores de tipeo.

Hice un pequeño desarrollo para una iniciativa comercial propia, me está funcionando correctamente con sqlite
Estuve viendo los servicios de hosting y en la mayoria aceptan MySQL. Entonces estoy tratando de pasar la base a MySQL, una base que enlaza con USER y GROUP del auth.

Python 2.7.3 (default, Aug  1 2012, 05:16:07) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>> MySQLdb.connect(host='localhost', user='SarahConnor', passwd='Technoir', db='USUARIOS')
<_mysql.connection open to 'localhost' at 8e1fbb4>
>>> 

#my.cnf
[client]
database = USUARIOS
user = SarahConnor
password = Technoir
default-character-set = utf8


#setting.py
...

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql', 
        'NAME': 'var/lib/mysql/USUARIOS',             
        'USER': 'SarahConnor',                      
        'PASSWORD': 'Tehcnoir',                
        'HOST': '',                    
        'OPTIONS': {
            'read_default_file': 'la dire a :/my.cnf',}
    }
}



python manage.py validate me devuelve:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/validate.py", line 9, in handle_noargs
    self.validate(display_num_errors=True)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 266, in validate
    num_errors = get_validation_errors(s, app)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 103, in get_validation_errors
    connection.validation.validate_field(e, opts, f)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/validation.py", line 14, in validate_field
    db_version = self.connection.get_server_version()
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 411, in get_server_version
    self.cursor()
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 306, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 387, in _cursor
    self.connection = Database.connect(**kwargs)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'SarahConnor'@'localhost' (using password: YES)")

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| USUARIOS           |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.00 sec)


mysql> show grants for 'SarahConnor'@'localhost';
+--------------------------------------------------------------------------------------------------------------------+
| Grants for SarahConnor en localhost                                                                                   |
+--------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'SarahConnor'@'localhost' IDENTIFIED BY PASSWORD '*4CEC73C0781FE22856D49A6CEC809D8FC30222BE' |
| GRANT ALL PRIVILEGES ON `USUARIOS`.* TO 'SarahConnor'@'localhost' WITH GRANT OPTION                                |
+--------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.24 sec)

Cualquier comentario se agradece!
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20120826/4d975104/attachment.html>


More information about the pyar mailing list