美文网首页
postgres数据库入门

postgres数据库入门

作者: 程南swimming | 来源:发表于2019-08-05 10:00 被阅读0次

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

相关文章

网友评论

      本文标题:postgres数据库入门

      本文链接:https://www.haomeiwen.com/subject/mpjpdctx.html