19
23

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 3 years have passed since last update.

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

Last updated at Posted at 2019-03-21

手順

まずは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

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

19
23
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
19
23

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?