在Ubuntu上使用pgAdmin監控數據庫,您可以按照以下步驟操作:
sudo apt update
sudo apt install pgadmin4
sudo systemctl start postgresql
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'your_password';"
sudo nano /etc/postgresql/12/main/pg_hba.conf
在文件末尾添加以下行:
host all all 0.0.0.0/0 md5
保存并關閉文件。然后,重新啟動PostgreSQL:
sudo systemctl restart postgresql
pgadmin4
在PgAdmin的左側面板中,右鍵單擊“Servers”并選擇“Create” - “Server…”。
在“General”選項卡中,輸入一個名稱(例如,“My PostgreSQL Server”)。
轉到“Connection”選項卡,輸入以下信息:
Host name: localhost
Port: 5432
Username: postgres
Password: your_password
單擊“Save”以保存設置并連接到PostgreSQL服務器。
請注意,具體的步驟可能會因pgAdmin版本和PostgreSQL版本的不同而有所差異。建議參考pgAdmin的官方文檔以獲取最準確的信息。