首先確保postgresql是否在運行,在命令窗口輸入 netstat -nlt
han@han-OptiPlex-7050:~/project/0_ng_practice/ng-test$ netstat -nlt
激活Internet連接 (僅服務器) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:63342 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:8081 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:5939 0.0.0.0:* LISTEN tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:1080 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:6942 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:4200 0.0.0.0:* LISTEN tcp6 0 0 ::1:631 :::* LISTEN
如果在運行,默認的5432端口就能被監聽到,請運行 sudo service postgresql stop 暫停服務。
在命令行輸入
sudo apt-get --purge remove postgresql
刪除postgresql安裝包,安裝刪除后還有刪除對應的配置
sudo rm -r /etc/postgresql/ sudo rm -r /etc/postgresql-common/ sudo rm -r /var/lib/postgresql/ sudo userdel -r postgres sudo groupdel postgres
到此,postgresql就從電腦中完全刪除了.