在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的官方文档以获取最准确的信息。