Remote connect to clearDB heroku database
https://stackoverflow.com/questions/9822313/remote-connect-to-cleardb-heroku-database/18413171
Last updated
Was this helpful?
https://stackoverflow.com/questions/9822313/remote-connect-to-cleardb-heroku-database/18413171
Last updated
Was this helpful?
Asked 7 years, 10 months agoActive Viewed 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? asked Mar 22 '12 at 12:294,2521212 gold badges3636 silver badges7373 bronze badges
171
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.com♦111 silver badgeanswered Apr 27 '12 at 20:592,76811 gold badge1919 silver badges2323 bronze badges
11You can also see this directly on the Heroku dashboard/website, just go to your app, click "Settings" and "Reveal config vars". –
1In my case at least, the us-cdbr-east.cleardb.com equivalent part was not the name of the database but rather the name of the host. The database name was however found on the dashboard for the ClearDB addon. –
1you'll need to export your local database file to the database created by Heroku. Just follow this video and you'll be good to go –
80
You run heroku config to get the CLEARDB_DATABASE_URL
and it should be something of this format:
So basically you just look at your own url and get all you want from there. That's how i set up mysql workbench.6,04233 gold badges3030 silver badges5050 bronze badgesanswered Jul 26 '12 at 9:5186111 gold badge77 silver badges99 bronze badges
3Thank you @Andrei but what about the port for the database? –
2@BKSpurgeon. I got it to work with phpMyAdmin with the default port (See ) –
This is much simpler :) –
Thank you so much Mr. It helps me deploy my mysql file to heroku successfully –
@AbhishekDivekar your comment helped me a lot. I just changed the username and some stuff on a congig.inc.php file in my xamp and it worked on PHPMyAdmin. –
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
I did a video explaining how to connect to MySql using NodeJS on a Heroku server, take a look:
This is the code in case you want to see:
Here is part of the code:
Paste this inside terminal:
You can use this one-liner to connect to your MySQL database in your terminal.
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.
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.
should consider getting the credentials of vars in heroku configurations (Config Vars):
14
DATABASE NAME = heroku_4a1dc3673c4114danswered Oct 5 '17 at 9:593,32233 gold badges2121 silver badges3030 bronze badges10
CHeers! MAGIC: answered Aug 23 '13 at 23:092,44288 gold badges3737 silver badges6060 bronze badges
4Don't know why this is so heavily downvoted.. your createConnection cleared things up for me. Thanks :) –
3Reason for down-votes also should be provided. This is the answer that helped me. Thanks, Bro! –
2
33.7k88 gold badges6464 silver badges7878 bronze badgesanswered Sep 30 '16 at 14:292111 bronze badge1
answered Feb 3 '17 at 12:121,4431414 silver badges2525 bronze badges1
answered Apr 4 '19 at 16:4677811 gold badge77 silver badges1818 bronze badges
I tried this solution but this is not working. But this solution is working fine in Sequal Pro. –
0
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...answered Mar 22 '12 at 14:1021.1k1717 gold badges7373 silver badges125125 bronze badges0
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.answered May 24 '18 at 14:22111 bronze badge0
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.answered Sep 13 '18 at 18:1810
CLEARDB_DATABASE_URLanswered Jul 15 '19 at 19:391,7001515 silver badges1515 bronze badges-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.answered Feb 19 '13 at 1:453911 bronze badge
4That's good to know, but how does that help the OP find their connection information? –
1You are right, but I just added an info, because Neil Middleton said "Assuming you can connect to ClearDB directly", then I just said Yes, he can. I apologize for answering something that haven't helped the main question. –
No worries. Things like this are really good comment material, but it looks like you need a few more rep still for that. –
i have 0 problems gettig to the heroku service. but from the service to db is where the issue lies. boooo. gettig "dial tcp 127.0.0.1:3306: getsockopt: connection refused" –