(*^ - ^)❯postgres --version
postgres (PostgreSQL) 10.0
ない場合は、`brew install postgresql'
DBの設定
initdb /usr/local/var/postgres -E utf8
パーミッションのエラーが出た場合
The files belonging to this database system will be owned by user "ユーザー名".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /usr/local/var/postgres ... initdb: could not change permissions of directory "/usr/local/var/postgres": Operation not permitted
sudo chown -R
whoami/usr/local
権限を変えておく。
サーバーの起動
brew services start postgresql
データベースの確認
psql -l
ユーザーを作成しておくと良いかも
Plug 'vim-scripts/dbext.vim', { 'for': 'sql' }
let g:dbext_default_profile_psql = 'type=PGSQL:host=localhost:port=5432:dbname=squat:user=kage'
let g:dbext_default_profile = 'psql'
let dbext_default_buffer_lines=30
$HOMEに.pgpassを作成しておく
hostname:port:database:username:password
一行で良い。
.pgpassに関して、warningが出るようであればchmod 600 .pgpass
しておけば警告は消える。
コマンドに関しては、リンクを参照