I'm trying to launch a Go app on Heroku. This app does use a fairly large SQL database; currently, the database is on my local and I call this
db, err := sqlx.MustConnect("mysql", username+":"+password+"@tcp(localhost:3306)/"+environment)
in my code. The data is accessible as a .sql
file from an AWS bucket. Is there anyway I could have my app directly connect to this sql file, or host the database somewhere other than localhost?
https://devcenter.heroku.com/articles/heroku-mysql
In heroku website, go to My Apps and select the app on which you have installed ClearDB.
On the top corner click on Addons and then select ClearDB MySQL Database. Once there, click on your database and choose the 'Endpoint Information' tab. There you see your username/password. The URL to the database can be acquired by running heroku config --app <YOUR-APP-NAME>
in the command line.
In my case, it was something like: mysql://user:pass@us-cdbr-east.cleardb.com/TABLE?reconnect=true What you need is this part: us-cdbr-east.cleardb.com