| Bug #67333 | access denied when conecting to a db | ||
|---|---|---|---|
| Submitted: | 23 Oct 2012 2:57 | Modified: | 2 Jul 2013 7:23 |
| Reporter: | lynn01 lynn01 | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | Connector / Python | Severity: | S3 (Non-critical) |
| Version: | OS: | Linux | |
| Assigned to: | Geert Vanderkelen | CPU Architecture: | Any |
[23 Oct 2012 3:00]
lynn01 lynn01
python 2.6 os centos 5 mysql 5.0.67 mysql-connector 1.0.6b2
[23 Oct 2012 3:51]
lynn01 lynn01
I have just find that the default host is 127.0.0.1, after I grant to user on this ip address it will be ok to connect. But If specify the host param in the connect fuction as host='localhost', it still connect to 127.0.0.1, the other user still connect to '%'. The host param is just not working.
[23 Oct 2012 4:24]
lynn01 lynn01
I have figure out that i have understand the host pram wrong. The final answer is this: mysql_conector seems to connect to mysqld as 127.0.0.1, I don't grant user auth on this ip, for /etc/hosts, there is also no localhost 127.0.0.1, so i don't know whether the server will do the reverse dns query. oursql seems to be still using localhost instead of 127.0.0.1, so there is no problem for it.
[30 May 2013 7:06]
jiang xiaobing
should close this issue?

Description: /usr/lib/python2.6/site-packages/mysql_connector_python-1.0.6b2-py2.6.egg/mysql/ connector/connection.pyc in _open_connection(self) 290 self._do_auth(self._user, self._password, 291 self._database, self._client_flags, self._charset_ id, --> 292 self._ssl) 293 self.set_converter_class(MySQLConverter) 294 if self._client_flags & ClientFlag.COMPRESS: /usr/lib/python2.6/site-packages/mysql_connector_python-1.0.6b2-py2.6.egg/mysql/ connector/connection.pyc in _do_auth(self, username, password, database, client_ flags, charset, ssl_options) 158 "Password Hashing in the latest MySQL manual") 159 elif packet[4] == '\xff': --> 160 raise errors.get_exception(packet) 161 162 try: ProgrammingError: 1045 (28000): Access denied for user 'user2'@'127.0.0.1' (using password: YES)' ProgrammingError: 1044 (42000): Access denied for user 'user'@'%' to database 'dashboard' I specified password (tried both params passwd and password) for both these two user and it's ok to connect with oursql extension use same username and password. grants for user and user2: | GRANT USAGE ON *.* TO 'user'@'localhost' IDENTIFIED BY PASSWORD '*ACB0363FE9E066140ED4963E3221516E57921ABC' | GRANT ALL PRIVILEGES ON `dashboard`.* TO 'user'@'localhost GRANT ALL PRIVILEGES ON *.* TO 'user2'@'localhost' IDENTIFIED BY PASSWORD '*ACB0363FE9E066140ED4963E3221516E57921ABC' | How to repeat: none