I have this code to connect to a rds instance:
import MySQLdb
USERNAME = 'root'
PASSWORD = 'pass'
DB_NAME = 'databasetest2'
print "Connecting to RDS instance"
conn = MySQLdb.connect ( host = 'mysql-db-instance-database-test2.code.us-east-1.rds.amazonaws.com', user = USERNAME, passwd = PASSWORD, db = DB_NAME, port = 3306)
print "Connected to RDS instance"
But Im having this error:
Connecting to RDS instance
Traceback (most recent call last):
File "mysql.py", line 10, in <module>
conn = MySQLdb.connect ( host = 'mysql-db-instance-database-test2.code.us-east-1.rds.amazonaws.com', user = USERNAME, passwd = PASSWORD, db = DB_NAME, port = 3306)
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: (2003, "Can't connect to MySQL server on 'mysql-db-instance-database-test2.code.us-east-1.rds.amazonaws.com' (110)")
Do you see why Im having this error?
Aucun commentaire:
Enregistrer un commentaire