Reputation: 9136
I have created a free instance of Heroku cleardb instance for my app. I set the database URL as:
heroku config:set DATABASE_URL='mysql://user:[email protected]/heroku_database?reconnect=true'
I'm trying to connect using a Go
app. But when I try to access my application, it gives the following mysql error:
default addr for network 'us-cdbr-iron-east-03.cleardb.net' unknown
I tried to set the database url with protocol and port as well:
heroku config:set DATABASE_URL='mysql://user:pass@tcp(us-cdbr-iron-east-03.cleardb.net:3306)/heroku__database?reconnect=true'
This changes the errror to:
Access denied for user
which i'm guessing is because direct access to port is disallowed. Does anybody know what is the issue here?
Upvotes: 3
Views: 1193
Reputation: 9136
This is a Go
specific problem. Three changes are required:
Go
's sql.Open
already takes scheme as its first parameter so it needs to be stripped off of DATABASE_URL
.?reconnect=true
).Thus final database URL would be:
DATABASE_URL='user:pass@tcp(us-cdbr-iron-east-03.cleardb.net:3306)/your_heroku_database'
Upvotes: 7