mac重启postgresql的方法

不懂mac重启postgresql的方法?其实想解决这个问题也不难,下面让小编带着大家一起学习怎么去解决,希望大家阅读完这篇文章后大所收获。

Mac下安装postgresql

brew install postgresql -v

初始化配置

initdb /usr/local/var/postgres -E utf8

启动

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

创建用户,创建db

createuser <username> -P
createdb <dbname> -O <username> -E UTF8 -e

连接数据库

psql -U <username> -d <dbname> -h 127.0.0.1

list数据库

\l 或不进入终端的情况下执行psql -l

感谢你能够认真阅读完这篇文章,希望小编分享mac重启postgresql的方法内容对大家有帮助,同时也希望大家多多支持亿速云,关注行业资讯频道,遇到问题就找亿速云,详细的解决方法等着你来学习!