网站首页 > 教程文章 正文
方法1:
psql postgresql://postgres:pg123@172.17.0.3:5434/postgres
postgresql协议名称
postgresql 用户名
pg123 密码
172.17.0.3 ip
5434 port
postgres 需要访问的数据库名称
方法2:
psql -U postgres -h172.17.0.3 -p5434 -dpostgres
-U 用户名
-h 数据库IP
-p 数据库端口
-d 需要访问的数据库名称
如果想用psql直接连接数据库,需要通过设置postgres用户的环境变量来实现:
export PGHOME=/usr/pgsql-13
export PGUSER=postgres
export PGPORT=5434
export PGHOST=localhost
export PATH=$PGHOME/bin:$PATH:$HOME/bin
- 上一篇: PostgreSQL性能优化之服务器参数配置
- 下一篇: PostgreSQL HAVING子句
猜你喜欢
- 2025-01-10 AI编程之手把手教你在CentOS安装Postgresql的Vector向量数据库
- 2025-01-10 postgresql在centos安装
- 2025-01-10 PostgreSQL技术内幕13:PostgreSQL通讯协议
- 2025-01-10 等保2.0测评:PostgreSQL数据库
- 2025-01-10 PostgreSQL技术内幕10:PostgreSQL事务原理解析-日志模块介绍
- 2025-01-10 基于patroni+etcd打造可自动故障转移的PostgreSQL集群
- 2025-01-10 新手如何快速搭建多套PostgreSQL集群
- 2025-01-10 PostgreSQL是不是你的下一个JSON数据库?
- 2025-01-10 轻松入门PostgreSQL:安装和设置数据库的完整指南!
- 2025-01-10 PostgreSQL、MySQL 数据库被入侵究竟有多么普遍?有人做了一项实验
- 最近发表
- 标签列表
-
- location.href (44)
- document.ready (36)
- git checkout -b (34)
- 跃点数 (35)
- 阿里云镜像地址 (33)
- qt qmessagebox (36)
- mybatis plus page (35)
- vue @scroll (38)
- 堆栈区别 (33)
- 什么是容器 (33)
- sha1 md5 (33)
- navicat导出数据 (34)
- 阿里云acp考试 (33)
- 阿里云 nacos (34)
- redhat官网下载镜像 (36)
- srs服务器 (33)
- pico开发者 (33)
- https的端口号 (34)
- vscode更改主题 (35)
- 阿里云资源池 (34)
- os.path.join (33)
- redis aof rdb 区别 (33)
- 302跳转 (33)
- http method (35)
- js array splice (33)