Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
How to connect golang application to managed mysql?
I’m working with digitalocean for the first time and I try to connect my golang application (set-up as an app incl. builds from gitlab) to a mysql dbase (as dbase cluster). The golang build is ok, and I can connect to the mysql database using mysql workbench on my local pc.
However, the application itself cannot access the managed mysql database (i added it to trusted sources). When the application tries to connect, I get the following error:
[ERROR] Unable to open database [default addr for network ‘private-xxxxxxxxxx-mysql-do-user-xxxxxxxx-0.b.db.ondigitalocean.com:25060’ unknown]
I tried using the default environment variable DATABASE_URL, as well as manually setting the connectstring (with of course the correct details):
Could it be that i have to install something else, or maybe another mysql client or install a certificate? Btw i used the github.com/go-sql-driver/mysql package in golang.
Any help is appreciated!
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.×