Help us understand the problem. What is going on with this article?

【RDS for PostgreSQL】EC2からRDSへのログイン方法

More than 1 year has passed since last update.

前提

  • EC2作成済み
  • RDS作成済み

手順

1)EC2にpsqlをインストール

  • EC2にログイン
  • リポジトリからパッケージを検索
$ yum search postgresql
(略)
postgresql.x86_64 : PostgreSQL client programs
(略)
  • パッケージのインストール
$ sudo yum -y install postgresql.x86_64
  • インストール済みのパッケージ確認
$ yum list postgresql
読み込んだプラグイン:extras_suggestions, langpacks, priorities, update-motd
インストール済みパッケージ
postgresql.x86_64                                         9.2.24-1.amzn2.0.1                                         @amzn2-core
  • psqlのバージョン確認
$ psql -V
psql (PostgreSQL) 9.2.24

2)EC2からRDS for PostgreSQLへログイン

  • ログイン
$ sudo psql --host=pos-test.xxxxx.us-west-2.rds.amazonaws.com  --port=5432 --username=db_user --password --dbname=pos_test
ユーザ db_user のパスワード:xxxxx
オプション 説明
--host エンドポイント名
--port ポート番号
--username マスターユーザ名
--dbname DB名
  • ログインできたのでバージョンでも確認してみる
pos_test=> SELECT version();
                                                version
--------------------------------------------------------------------------------------------------------
 PostgreSQL 10.6 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9), 64-bit
(1 )

  • PostgreSQLの接続を切断
pos_test-> \q
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした