Database access via terminal

Connect to the remote database hosted on fortrabbit from your local machine by terminal commands.

The following commands are run on your local computer. The mysql command line client is required. Exact commands may differ depending on the kind of local development environment.

# 1. Create a tunnel in a dedicated terminal window
ssh -N -L 13306:mysql:3306 {{app-env-id}}@ssh.{{region}}.frbit.app
# This will have no output. That's Ok. Open a new window
shell
# 2. In a new window connect to the database
$ mysql -u {{app-env-id}} -h127.0.0.1 -P13306 -p -D {{app-env-id}}
# In the next step you will be asked for your MySQL password.
shell

# Next

# Port setting

Port local 13306 is just an example, any port in the range 1025-65535 can be used. The remote port 3306 must be 3306. This command is not supposed to print a confirmation message. If nothing shows up: you did it right!

# Troubleshooting

  • The most common issue is to expect output with the tunnel command. No response is good. Open a new terminal window and continue.
  • The second most common issue is to expect output with the tunnel command. No response is good. Open a new terminal window and continue.
  • The third most common issue is to expect output with the tunnel command. No response is good. Open a new terminal window and continue.
  • It's 127.0.0.1 not localhost.

Found a tpyo?Edit