0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【メモ】PostgreSQL初期設定【MacOS】

Posted at

MacOSのローカル環境ででbrewコマンドを利用して、PostgreSQLに接続したい場合の設定
※Laravelアプリケーション利用を想定

.env
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=your_database_name
DB_USERNAME=your_username
DB_PASSWORD=your_password
brew install postgresql
brew services start postgresql
brew services list

# DBに接続
psql postgres
# ユーザーを作成
CREATE DATABASE your_database_name;
CREATE USER your_username WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE your_database_name TO your_username;
# Laravelアプリケーション
php artisan config:cache
php artisan config:clear
# 作成したユーザーでDBに再度アクセスする
psql -U your_username -d your_database_name
# テーブル一覧を確認
\dt
0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?