在Ubuntu上使用PgAdmin管理PostgreSQL数据库的步骤如下:
sudo apt update
sudo apt install postgresql postgresql-contrib
sudo adduser postgres
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'your_password';"
sudo apt install pgadmin4
sudo /usr/pgadmin4/bin/setup-web.sh
sudo systemctl start pgadmin4
http://your_server_ip:5050
在PgAdmin的左侧面板中,右键单击“Servers”并选择“Create” “Server…”。
在“General”选项卡中,输入一个名称(例如,“My PostgreSQL Server”)。
转到“Connection”选项卡,输入以下信息:
在“Databases”目录下,右击并选择“Create” “Database…”。
输入数据库名称和相关信息。
展开数据库,右键单击“Schemas” “public” “Tables”并选择“Create” “Table…”。
输入表名称并定义列和数据类型。
右键单击相应的表并选择“Query Tool”。
在查询工具中,输入SQL查询并单击“Execute”按钮。