Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
22
Help us understand the problem. What are the problem?

posted at

updated at

Windows10のWSL(Ubuntu)にPostgreSQLをインストールしたときのメモ

手順

まずはPostgreSQLのインストール.

$ sudo apt update
$ sudo apt install postgresql

念のため再起動.

$ sudo /etc/init.d/postgresql restart

(Ubuntuの)ユーザpostgresに切り替える.

$ sudo -u postgres -i

(postgresの)ユーザuserを作る.パスワードを聞かれるが適当に設定する.

$ createuser -d -U postgres -P user

user用データベースuserdbを作る.

$ createdb userdb --encoding=UTF-8 --owner=user

Ctrl+Dを押すなどして(Ubuntuの)ユーザpostgresから元のユーザに戻ってログインできるか確認.

$ psql -U user -h localhost -d userdb

設定したパスワードを入力すればログインできる.

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
22
Help us understand the problem. What are the problem?