Skip to content
Trellis
v1.23.0

Database Access

Accessing your databases with client software like Sequel Pro, Sequel Ace and TablePlus is straight forward with trellis-cli. Run the following from any directory within your project:

For Sequel Pro (or Sequel Ace):

$ trellis db open --app=sequel-pro production example.com

For TablePlus

$ trellis db open --app=tableplus production example.com

SSH Password?

Because Trellis provisions remote environments to use SSH keys rather than passwords, the password field or prompt is left blank.

# Connection details

To access database passwords, run:

$ trellis vault view <environment> | grep "db_password"

# Development

  • Connection type: SSH
  • MySQL host: 127.0.0.1
  • Username: example_com
  • Password: example_dbpassword
  • SSH Host: example.test
  • SSH User: vagrant
  • SSH Key: Select the following file from your Trellis directory: .vagrant/machines/default/virtualbox/private_key

# Remote servers

  • Connection type: SSH
  • MySQL host: 127.0.0.1
  • Username: example_com
  • Password: example_dbpassword
  • SSH Host: example.com
  • SSH User: web

# Vagrant and SSH configs

Regardless of if you're using trellis-cli or doing it manually, Vagrant boxes require some additional configuration since they require an SSH private key.

Since the path of this private key depends on the Vagrant provider (eg: VirtualBox or Parallels) you're using, we recommend making sure that your database GUI app of choice is properly configured to respect your local SSH config (usually in ~/.ssh/config).

Trellis' Vagrant integration automatically adds the necessary configuration to your SSH config for each Vagrant machine.

The main thing to verify is that you can SSH into your Vagrant machine with ssh vagrant@<hostname>. If that works, then your SSH config is setup properly and will make any database access over SSH easier.

# Sequel Ace

In Sequel Ace, you need to set your SSH config and SSH known hosts file, then additionally give the app access to those files and your Vagrant private key.

See this Discourse post for full details on this process.

# TablePlus

For TablePlus and VirtualBox, you need to manually select the private key from .vagrant/machines/default/virtualbox/private_key.

Contributors

Last updated

Support Roots

Help us continue to build and maintain our open source projects. We’re a small team of independent developers and every little bit helps.

Sponsor Roots on GitHub