Remote connect to clearDB heroku database

https://stackoverflow.com/questions/9822313/remote-connect-to-cleardb-heroku-database/18413171

Ask Questionarrow-up-rightAsked 7 years, 10 months agoActive 6 months agoarrow-up-rightViewed 65k times9432

How can i perform a remote connect to ClearDB MySQL database on heroku using for example MySQL Query Browser. Where to get url, port, login and password?mysqlarrow-up-right databasearrow-up-right herokuarrow-up-right database-connectionarrow-up-rightsharearrow-up-rightimprove this questionarrow-up-rightasked Mar 22 '12 at 12:29arrow-up-rightromanarrow-up-right4,2521212 gold badges3636 silver badges7373 bronze badgesadd a commentarrow-up-right

12 Answers

activearrow-up-rightoldestarrow-up-rightvotesarrow-up-right171

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/DATABASE?reconnect=true What you need is this part: us-cdbr-east.cleardb.comsharearrow-up-rightimprove this answerarrow-up-rightedited Oct 29 '16 at 11:15arrow-up-rightarrow-up-rightCommunityarrow-up-right♦111 silver badgeanswered Apr 27 '12 at 20:59arrow-up-rightAbbasarrow-up-right2,76811 gold badge1919 silver badges2323 bronze badges

add a commentarrow-up-right80

You run heroku config to get the CLEARDB_DATABASE_URL and it should be something of this format:

CLEARDB_DATABASE_URL => mysql://[username]:[password]@[host]/[database name]?reconnect=true

So basically you just look at your own url and get all you want from there. That's how i set up mysql workbench.sharearrow-up-rightimprove this answerarrow-up-rightedited Jul 27 '12 at 7:11arrow-up-rightarrow-up-rightDruidarrow-up-right6,04233 gold badges3030 silver badges5050 bronze badgesanswered Jul 26 '12 at 9:51arrow-up-rightAndreiarrow-up-right86111 gold badge77 silver badges99 bronze badges

add a commentarrow-up-right14

Paste this command in terminal

After this you will get Database URL. e.g this is your cleardb database URL.

Than this will be your database credentials. (Extracted from Above URL)

USER NAME = b0600ea495asds

PASSWORD = 9cd2b111

HOST = us-cdbr-hirone-west- 06.cleardb.net

DATABASE NAME = heroku_4a1dc3673c4114dsharearrow-up-rightimprove this answerarrow-up-rightanswered Oct 5 '17 at 9:59arrow-up-rightDevelopinearrow-up-right3,32233 gold badges2121 silver badges3030 bronze badgesadd a commentarrow-up-right10

I did a video explaining how to connect to MySql using NodeJS on a Heroku server, take a look:

http://www.youtube.com/watch?v=2OGHdii_42sarrow-up-right

This is the code in case you want to see:

https://github.com/mescalito/MySql-NodeJS-Herokuarrow-up-right

Here is part of the code:

CHeers! MAGIC: http://makegif.com/g9yv.gifarrow-up-rightsharearrow-up-rightimprove this answerarrow-up-rightanswered Aug 23 '13 at 23:09arrow-up-rightlitoarrow-up-right2,44288 gold badges3737 silver badges6060 bronze badges

add a commentarrow-up-right2

Paste this inside terminal:

sharearrow-up-rightimprove this answerarrow-up-rightedited Sep 30 '16 at 14:35arrow-up-rightarrow-up-rightPaul Roubarrow-up-right33.7k88 gold badges6464 silver badges7878 bronze badgesanswered Sep 30 '16 at 14:29arrow-up-rightuser3805474arrow-up-right2111 bronze badgeadd a commentarrow-up-right1

You can use this one-liner to connect to your MySQL database in your terminal.

sharearrow-up-rightimprove this answerarrow-up-rightanswered Feb 3 '17 at 12:12arrow-up-rightSébastien Saunierarrow-up-right1,4431414 silver badges2525 bronze badgesadd a commentarrow-up-right1

If you are using mySQL workbench, follow this schema. Go to Heroku > Your Applications Settings > Config Vars, and show the long URL. That url includes your username, password, the URL of the database and the default schema. Paste all of the information as follows below, and you will be able to successfully connect to the database. There was no real explaination on how to connect to ClearDB using mySQL workbench on this thread, so hopefully this helps someone who was struggling.

enter image description herearrow-up-rightsharearrow-up-rightimprove this answerarrow-up-rightanswered Apr 4 '19 at 16:46arrow-up-rightJordan Schuetzarrow-up-right77811 gold badge77 silver badges1818 bronze badges

add a commentarrow-up-right0

All the details will be in the database URL which can be found in heroku config. Assuming you can connect to ClearDB directly (I've never tried), these should be all you need...sharearrow-up-rightimprove this answerarrow-up-rightanswered Mar 22 '12 at 14:10arrow-up-rightNeil Middletonarrow-up-right21.1k1717 gold badges7373 silver badges125125 bronze badgesadd a commentarrow-up-right0

Go to your app on heroku and click to the 'settings' tab. Then click the button on the second option that says 'reveal config vars'.

You should find, listed under the CLEARDB_DATABASE_URL variable, something like this...

mysql://[username]:[password]@[host]/[database name]?reconnect=true

So the [host portion] is your host. The [database name] portion is your db name, of course.

You still need your username and password. Go back to the 'overview' tab in heroku. Go to the ClearDB add-on in your installed add-ons section. Click the database you want to access (probably only 1 option there). Click the 'system information' tab. You should see your username and password.

that should be all you need to access your database. I use sequel pro. I just plugged that info (name, host, into the 'standard' tab and I was good to go.sharearrow-up-rightimprove this answerarrow-up-rightanswered May 24 '18 at 14:22arrow-up-rightuser2364424arrow-up-right111 bronze badgeadd a commentarrow-up-right0

All of this worked perfectly for me. Using heroku config | grep, as described above and then simply adding another entry into my config.inc.php for use by phpMyAdmin and I can access my cleardb database remotely. It saves me having to have SQL locally and using postgres with Heroku.sharearrow-up-rightimprove this answerarrow-up-rightanswered Sep 13 '18 at 18:18arrow-up-rightGiantCoderarrow-up-right1add a commentarrow-up-right0

should consider getting the credentials of vars in heroku configurations (Config Vars):

CLEARDB_DATABASE_URLsharearrow-up-rightimprove this answerarrow-up-rightanswered Jul 15 '19 at 19:39arrow-up-rightDiego Santa Cruz Mendezúarrow-up-right1,7001515 silver badges1515 bronze badgesadd a commentarrow-up-right-1

Yes, you can connect to ClearDB directly, actually I use Workbench to connect. Then you can use the same DB for your localhost and for heroku.sharearrow-up-rightimprove this answerarrow-up-rightanswered Feb 19 '13 at 1:45arrow-up-rightAlisson Reinaldo Silvaarrow-up-right3911 bronze badge

Last updated