0

I am connecting to another system's MySQL in our local network. This is what I did:

import MySQLdb

db = MySQLdb.connect('192.168.100.30','nvnew','nvnew','disdb')
cur = db.cursor()

This is the error I got:

super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on '192.168.100.30' (111)")

I have created the user 'nvnew', granted all the privileges, even manually logged in by that user name to test, so i don't know why the error is coming. I searched google and read all the answers still unable to solve this as everywhere, they show this syntax as correct.

I read somewhere to comment the line

bind-address = 127.0.0.1

in /etc/mysql/my.cnf file. I did that but still I am getting the same error. Also, while connecting to remote system's mysql from my system's terminal using.

mysql -h 192.168.100.30 -u nvnew -p

I was unable to get connected to that.

Can you help?

oxfn
  • 6,590
  • 2
  • 26
  • 34
Neha Verma
  • 63
  • 6
  • have you tried http://stackoverflow.com/questions/16472175/operationalerror-operationalerror-2003-cant-connect-to-mysql-server-on-1 – xor Feb 13 '14 at 11:22
  • Please be kind and give us some feedback. If there was helpful answer you should mark it as accepted and if you've found solution by yourself, please, post it as a new answer – oxfn Feb 18 '14 at 07:27

2 Answers2

0

Try to bind it to exact IP 192.168.100.30 (guess, it is static address) instead of commenting

bind-address = 192.168.100.30
oxfn
  • 6,590
  • 2
  • 26
  • 34
0

Did you restart the remote MySQL daemon after editing the configuration?

(You can use netstat -ltpn to find out if it's listening on 127.0.0.1 or 0.0.0.0.)

Also, be sure you understand the implications of having MySQL bind to all addresses instead of 127.0.0.1 only.

AKX
  • 152,115
  • 15
  • 115
  • 172