pgAdmin

pgAdmin - PostgreSQL管理工具 是最流行的开源 PostgreSQL管理工具:

  • 支持不同平台不同版本的PostgreSQL和EDB Postgres Advanced Server的管理

  • 两种部署模式: 桌面模式(使用electron) 和 服务器模式(通过web允许多用户同时使用)

  • 语法高亮的强大查询工具

  • 图形化查询计划显示

  • 通过引导来帮助更新ACL

  • 过程语言调试(pl/pgsql和edb-sql支持)

  • 通过Schema diff工具俩管理不同的schemas

  • 自动回收管理

  • 监控

  • 备份、恢复、垃圾回收和按需分析

  • SQL/shell/批任务 调度代理

启动配置

我的测试环境是在 macos 安装PostgreSQL ,采用 Homebrew 安装完成后,通过命令行启动:

使用命令启动 PostgreSQL
LC_ALL="C" /usr/local/opt/postgresql@17/bin/postgres -D /usr/local/var/postgresql@17

然后配置 pgadmin 来访问这个本地PostgreSQL数据库,所以配置访问 127.0.0.1 端口 5432 ,但是初次访问提示 FATAL: role "postgres" does not exit :

../../_images/pgadmin_local_error.png

访问本地PostgreSQL显示 postgres 角色不存在

参考 psql: FATAL: role "postgres" does not exist ,对于通过 Homebrew 完成的 macos 安装PostgreSQL ,需要执行以下命令创建一个 postgres 用户:

通过 Homebrew 安装的PostgreSQL,需要创建一个 postgres 系统用户角色
/usr/local/opt/postgresql@17/bin/createuser -s postgres

创建了 postgres 系统用户之后,就可以正常访问并看到dashboard:

../../_images/pgadmin_dashboard.png

参考