https://www.jianshu.com/p/9e91aa8782da
第一步:安装
安装:brew install postgresql
初始化:initdb /usr/local/var/postgres
启动服务:pg_ctl -D /usr/local/var/postgres -l logfile start
第二步:常用操作
创建数据库:CREATE DATABASE jdmta_test OWNER postgres;


直接通过psql命令执行SQL文件 这种方式无需先登录数据库,直接用一个命令就可以了:
psql-d db1 -U userA -f /pathA/xxx.sql
问题1:psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
解决:pg_ctl -D /usr/local/var/postgres -l logfile stop
pg_ctl -D /usr/local/var/postgres -l logfile start
postgres客户端的使用
点小象,就可以打开gui界面,访问postgresql

网友评论