--- tags: d3bu.netに移行済み --- # ポスグレの設定 メモ程度. debian bullseye, pgdb v13を想定 ## リポジトリ なんでdebian系は公式リポジトリのパッケージはあそこまで枯らすのか. ```bash $ curl -L https://www.postgresql.org/media/keys/ACCC4CF8.asc | doas gpg --dearmor -o /usr/share/keyrings/postgr esql.gpg ``` そしたら`/etc/apt/sources.list.d/postgresql.list`の内容を以下のようにする. ``` deb [signed-by=/usr/share/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ``` 以下を忘れないように実行. ```bash $ sudo apt update ``` ## インストール ```bash $ sudo apt install postgresql postgresql-common ``` ## 権限とか デフォルトではパスワードで接続できない.頭がおかしいんだろうか. ```diff - local all all peer + local all all md5 - local replication all peer + local replication all md5 ``` ## いざ接続 できませんよね.ロール作ってないので. ```bash $ sudo -u postgres psql ``` デフォルト設定だと`postgres`に関してはpeer認証なのでパスワードは聞かれない. ```sql > CREATE ROLE hoge WITH LOGIN PASSWORD 'hogepass'; ``` 以上. ## はじめてのDB `ADMIN`のあるロールで操作(さっきの`postgres`で大丈夫) ```sql > CREATE DATABASE hogedb WITH OWNER hoge; ``` hogeはhogedbの中では好き勝手できます.
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.