51
31

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Sequel Pro で踏み台サーバ経由で接続したサーバからデータベース接続する方法

Posted at

概要

本番環境など、個人鍵を利用した踏み台サーバ経由でしか接続できないサーバがあり、そこからしか接続できないデータベースにアクセスしたいケースで Sequel Pro で接続したいときに調べた方法です。

やりたいこと

以下の状態で、クライアントから Sequel Pro で本番データベースに接続する。

SS2.png

設定手順

1. ~/.ssh/config を作成する。

~/.ssh/config に以下の内容を記載する。

~/.ssh/config
#  踏み台サーバへの接続設定
Host step-server
  Hostname xx.xx.xx.100
  Port 22
  User step-server-user-name
  IdentityFIle ~/key/step-server-key

# データベースに接続できるサーバへの接続設定
# SSHホストに記入する名前
Host production-server
  Hostname xx.xx.xx.101
  Port 22
  # SSHユーザに記入する名前
  User prudouction-server-user-name
  ProxyCommand ssh step-server nc %h %p
  # SSH鍵に記入する鍵
  IdentityFIle ~/pem/production-server.pem

2. Sequel Pro の設定を記載する。

ss.png

3. 接続する。

接続時に、 step-server-key のパスワードを求められるので、それを入力すると目的のデータベースに接続できます。

51
31
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
51
31

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?