postgresql 笔记

mac postgresql

http://www.jianshu.com/p/107235684ad0


launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

brew update
brew upgrade postgresql
initdb /usr/local/var/postgres -E utf8
pg_upgrade -b oldbindir -B newbindir -d olddatadir -D newdatadir
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

pg_ctl -D /usr/local/var/postgres stop -s -m fast

 

------

psql postgres
\du
create role stock with login password '123456' ;
\password postgres
createuser test --createdb
\list \l
\c

createuser -P -s -e
createdb -O owner

select current_user

select current_database(); 

//psql 操作

create role abc LOGIN password '123456';
create database abc ENCODING 'UTF8' OWNER abc;

posted @ 2017-04-21 20:46  anjunact  阅读(130)  评论(0编辑  收藏  举报