要在Ubuntu上配置pgAdmin,请按照以下步骤操作:
sudo apt update
sudo apt install postgresql pgadmin4
sudo systemctl start postgresql
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'your_password';"
/etc/postgresql/12/main/pg_hba.conf
(请注意,版本号可能会有所不同,需要根据实际安装的PostgreSQL版本进行调整)。host all all 0.0.0.0/0 md5
sudo systemctl restart postgresql
或者,在终端中输入以下命令启动PgAdmin:
pgadmin4
在PgAdmin的左侧面板中,右键单击“Servers”并选择“Create” “Server…”。
在“General”选项卡中,输入一个名称(例如,“My PostgreSQL Server”)。
转到“Connection”选项卡,输入以下信息:
Host name: localhost
Port: 5432
Username: postgres
Password: your_password
单击“Save”以保存设置并连接到PostgreSQL服务器。
如果需要修改PgAdmin的配置,可以编辑 /lib/python2.7/site-packages/pgadmin4/config_local.py
文件(请注意,路径可能因版本不同而有所变化)。
以上步骤将帮助您在Ubuntu上配置pgAdmin,使其能够连接并管理PostgreSQL数据库。如果在配置过程中遇到任何问题,可以参考官方文档或搜索相关错误信息以获得帮助。