0

I'm getting authentication error in connecting to remote Mysql. Code:

import MySQLdb as mdb

con = mdb.connect(host='xxx',port=3306,user= 'user', passwd='123',db= 'stellar')
cur = con.cursor()
cur.execute('show tables')
for r in cur:
    print(r)

Error:

Traceback (most recent call last):
  File "C:/staging_files/test.py", line 5, in <module>
    con = mdb.connect(host='xxx',port=3306,user= 'user', passwd='123',db= 'stellar')
  File "C:\Python34\lib\site-packages\MySQLdb\__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "C:\Python34\lib\site-packages\MySQLdb\connections.py", line 204, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'user'@'10.212.148.49' (using password: YES)")

I tried some of solutions suggested here. I ran command on Windows server hosting MySQL-

GRANT ALL ON DB.stellar TO user@xxx IDENTIFIED BY '123';

I also added- bind-address = 0.0.0.0 to my-default.cnf file

Community
  • 1
  • 1
pslover
  • 72
  • 1
  • 8
  • do you have `skip-networking` commented out in your `my.cnf`? – Jörn Hees May 25 '15 at 11:33
  • @JörnHees fthere is no option as `skip-networking`. Even there was no option as `bind-address` I added it myself. – pslover May 25 '15 at 12:22
  • http://stackoverflow.com/questions/29672480/host-xxxx-is-not-allowed-to-connect-to-this-mysql-server/29673533#29673533 – Akhil May 25 '15 at 13:30
  • @Akhil thanks. 1 question, the solution is for 1 IP. if i want to allow any host to connect to mysql server then how should I do it? Instead of `xx.xx.xx.xx` should I give `0.0.0.0` ? And user as well `some@0.0.0.0` – pslover May 25 '15 at 18:34
  • Remove `bind-address` completely from my.cnf. This means you are allowing "ALL" ip addresses – Akhil May 27 '15 at 12:51
  • @Akhil that I want. I want to allow access to all system in my network. But basic problem is still there `Authentication Error`. I'm trying to execute code on mysql server still I'm getting authentication error. – pslover May 28 '15 at 06:26

0 Answers0