cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error connecting to MySQL from Databricks: (2003, "Can't connect to MySQL server")

MadhuraC
New Contributor II

Hello Community,

I'm facing an issue connecting to a MySQL database hosted on AWS RDS from within a Data bricks notebook. My Python script to connect to MySQL works fine locally, but when I run it in Data bricks, I receive this error:

Error connecting to MySQL: (2003, "Can't connect to MySQL server (timed out)")

Additional Details:

  • Credentials: Confirmed correct (work locally).
  • Code: Using a standard pymysql connection within Databricks.
  • Troubleshooting Attempts:
    • Verified credentials.
    • Confirmed database is accessible from my local environment.
    • Checked AWS RDS instance security settings for IP or VPC connectivity.

Any insights into why this might be happening in Databricks, and how to resolve it, would be greatly appreciated!

Thank you!

2 REPLIES 2

Stefan-Koch
Contributor II

is it AzureDatabricks or Databricks on GCP, AWS?

Is your Databricks Workspace in a private V-NET?

MadhuraC
New Contributor II

It is Databricks in AWS.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group