I am using python's MySQLdb module on a windows 7 machine and trying to connect to a remote database on Amazon RDS (SQL Server Express). Here is the simple connection scheme I am using to establish a connection, but it never works:
import MySQLdb
cnx= {'host': 'dbname.xxxxxxxxxxxx.us-west-1.rds.amazonaws.com',
'username': 'username',
'password': 'password',
'db': 'dbname'}
db = MySQLdb.connect(cnx['host'],cnx['username'],cnx['password'], cnx['db'])
When i execute this connection script, it waits for a few seconds (10 to 15 secs mostly) and then gives out the following error:
OperationalError: (2003, "Can't connect to MySQL server on 'dbname.xxxx.us-west-1.rds.amazonaws.com' (10060)")
I have used sql server on localhost previously, and used to connect it using the same scheme and it worked always. Now, this is the first time I am dealing with a db on amazon rds and have no idea why this error is showing up..please help. Thanks.
Amazon RDS supports MySQL Community Edition versions 5.7 and 8.0 which means that the code, applications, and tools you already use today can be used with Amazon RDS.
Troubleshoot database level issuesBe sure that you're using the correct user name and password to access the instance from your DB client. Be sure that the user has the database permissions to connect to the DB instance. Check for any resource throttling in Amazon RDS, such as CPU or memory contention.
Follow the steps below to connect MySQL Workbench to your Amazon RDS DB instance: Download and install MySQL Workbench. Open MySQL Workbench, and then choose the ⊕ sign beside MySQL Connections to set up a new connection. In the Setup New Connection dialog box, enter a name for your connection.
It's been 7 months and likely you have already figured out by now... That's probably because you have not added the IP of machine where you are connecting from to the security group of the RDS instance. First go to the details page, click on the link to the security group, then you should find at the of the page to add IP of your connecting host.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With