Remote connect to clearDB heroku database

前端 未结 13 1813
故里飘歌
故里飘歌 2020-11-30 18:26

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?

相关标签:
13条回答
  • 2020-11-30 18:51

    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.

    0 讨论(0)
  • 2020-11-30 18:53

    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

    0 讨论(0)
  • 2020-11-30 18:59

    for windows users, there is no grep command.

    in this way just try for windows users

    heroku config
    

    you will get config.

    in another way go to settings in Heroku. then config var to check the variable.

    0 讨论(0)
  • 2020-11-30 19:01

    Paste this command in terminal

      heroku config | grep CLEARDB_DATABASE_URL
    

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

    'mysql://b0600ea495asds:9cd2b111@us-cdbr-hirone-west-
     06.cleardb.net/heroku_4a1dc3673c4114d?reconnect=true'
    

    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_4a1dc3673c4114d

    0 讨论(0)
  • 2020-11-30 19:01

    Paste this inside terminal:

    heroku config | grep CLEARDB_DATABASE_URL
    
    0 讨论(0)
  • 2020-11-30 19:06

    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.

    0 讨论(0)
提交回复
热议问题