在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”按鈕。