0

I am using below codes in Python to connect a remote MySQL server:

>>> import MySQLdb
>>> MySQLdb.connect(user = 'root', passwd = 'XXXXX', db = 'AAA', host = 'XX.XXX.XXX.104')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/anaconda3/lib/python3.7/site-packages/MySQLdb/__init__.py", line 84, in Connect
    return Connection(*args, **kwargs)
  File "/anaconda3/lib/python3.7/site-packages/MySQLdb/connections.py", line 164, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (2003, "Can't connect to MySQL server on 'XX.XXX.XXX.104' (60)")
>>> 

Any idea what went wrong and any remediation will be very helpful. Thanks,

6
  • It is VERY unusual that a remote MySQL server would allow anybody to connect to it using root as the userid. HUGE SECURITY RISK. So ask the server admin to create you a userid that is allowed to connnect from your remote ip(domain) Commented Mar 7, 2019 at 17:04
  • 1
    Maybe you can check this answer. I hope it helps. answer Commented Mar 7, 2019 at 17:06
  • Or if you are trying to connect to your remote server provided by a hosting company, they also dont always allow remote connection. But if they do your control panel should provide you with a userid or a mechanism of creating a userid that will be allowed to connect from a remote domain Commented Mar 7, 2019 at 17:06
  • And there's another similar issue cant connect to my sql Maybe it's the port - have you checked on which one you can connect? Might help to specify in the connection Commented Mar 7, 2019 at 17:08
  • Did you grant permissions for a remote root login? Usually you must GRANT and FLUSH to enable a remote connection. Also in your /etc/mysql/mysql.conf.d/mysqld.cnf. you may need to set the IP to 0.0.0.0. Check this one too stackoverflow.com/questions/6239131/… Commented Mar 7, 2019 at 18:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.