Hi everyone, hope someone could help. I am looking to use python to remotely connect to the DO’s MySQL database using the guide here:
Python code used:
import os import mysql.connector as database username = os.environ.get("username") password = os.environ.get("password") host_db = os.environ.get("host_db") db = os.environ.get("db") connection = database.connect( user=username, password=password, host=host_db, database=db)
however, I keep getting the error:
2003 (HY000): Can’t connect to MySQL server on ‘db-mysql-nyc1-16578-do-user-13436704-0.b.db.ondigitalocean.com:3306’ (10060)
One thing I am guessing (need help to verify) is that I enforced SSl (a ca certificate). Do I need to include the ca cert information in the connection?
Hope someone could help!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $200 of credit to try our products over 60 days!
You need to allow your connection on your Managed Database. Check the following tutorial, I think it will be of help to you:
You can connect to DigitalOcean Managed Databases using command line tools and other third-party clients. This guide explains where to find your MySQL database’s connection details and how to use them to configure tools and clients.
Can you verify that the credentials are correct, including the port?
You can find the logs of your managed database cluster by following these steps:
Each managed database comes with an SSL certificate. You can use this SSL certificate to encrypt connections between your client applications and the database
When you configure your client applications, you can use the certificate’s location on your local system. Each client application is configured differently, so check the documentation for the tool you’re using for more detail on setting up SSL connections.