美文网首页
登陆postgresql

登陆postgresql

作者: cabbywang | 来源:发表于2019-08-20 16:37 被阅读0次
  • 登陆数据库
psql -U dbuser -d exampledb -h 127.0.0.1 -p 5432

-U 指定用户
-d 指定数据库
-h 指定服务器
-p指定端口

  • 查看当前连接的用户名
select * from curent_user

select user
  • 备份和还原
    备份
pg_dump -U dbuser -h 127.0.0.1 -p 5432 exampledb > exampledb.sql

还原

psql -U dbuser -h 127.0.0.1 -p 5432 exampledb < exampledb.sql

相关文章

网友评论

      本文标题:登陆postgresql

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