Connecting to a Remote Platform.sh Database

by author Geoff St. Pierre on March 3rd 2017
blogpost

It's not complicated to connect to a platform.sh database; here's how!

Requirements

  • A database management application. I will use Sequel Pro in this post.
  • Set up a site on platform.sh.
    • Add your ssh-key to your account settings.

Instructions

Open up Sequel Pro and click the + in the bottom left corner to create a new connection. You will be prompted for connection settings. At the top there are three tabs. Each type of connection prompts for different settings. Select the ssh tab for a platform.sh connection.

sequel-pro-connection-screen

Let's break down the rest of the settings.

  • Name:
    • This can be anything that describes the database you are connecting to. I usually stick to the format: Example Site - Test.
  • MySQL Host:
    • This will literally be the string database.internal
  • Username:
    • Literally user
  • Password:
    • leave empty
  • Database:
    • Literally main
  • Port:
    • leave empty

The rest of the settings can easily be obtained through the ssh connection string provided by platform. To get the string, login to platform.sh, choose your project, hover over the Access site link, and copy the SSH ACCESS string to your clipboard.

  • SSH Host:
    • The part of the string after the @ ssh.us.platform.sh
  • SSH User:
    • This is the part of the string before the @ it consists of the platform site ID and the environment.
  • Leave the rest of the settings blank but make sure the Connect using SSL box is checked.

Sequel Pro should pick up your public key from your computer but if it can't you can browse to your public key to explicitly point to it (usually in ~/.ssh/).

That's it! Click Test Connection if it connects hit Save changes then Connect.

Conclusion

You now have a new favorite in your Sequel Pro sidebar that you can use to connect to your Platform.sh environment anytime you need it.

Read some other awesome Tandem adventures

authorMike Pirog, May 20th 2017

Learn how to use composer-based workflows with your Pantheon site on Kalabox so you can dev like it's 2017.

authorGeoff St. Pierre, May 10th 2017

How to work with Postgres Databases on Platorm.sh

authorGeoff St. Pierre, March 3rd 2017

Connecting to a remote Database on platform.sh is simple (when you know how)!