在 Ubuntu 上使用 pgAdmin 连接/添加 PostgreSQL 数据库,通常有两种理解:
下面分别说明。
pgadmin4
或浏览器访问:
http://127.0.0.1:5050
local_postgres)127.0.0.1 或 localhost5432postgrespostgres✅ 连接成功后,就能看到数据库列表。
testdbpostgres在 pgAdmin 的 Query Tool 中执行:
CREATE DATABASE testdb;
在 Connection 页面填写:
postgresql.conf / pg_hba.conf)sudo systemctl status postgresql
postgres 用户密码sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'newpass';"
如果你指的是 “Ubuntu 命令行创建数据库再用 pgAdmin 连接” 或 “Docker 中的 PostgreSQL + pgAdmin”,可以告诉我具体场景。