Ich versuche Postgresql auf Linux mit der Befehlszeilenschnittstelle zu lernen.So löschen Sie Postgresql-Datenbank auf Linux
Ich habe vor einiger Zeit einige Datenbanken hinzugefügt, gefolgt von einigen Tutorials (die ich seitdem alles vergessen habe, was ich gelernt habe).
Jetzt möchte ich diese Datenbanken löschen.
Ich machte die Annahme, dass ich dies tun sollte, indem Sie psql, die Befehlszeilenschnittstelle zu postgresql verwenden.
Sie können sehen, was ich in der folgenden Befehlszeile Ausgabe versucht habe, und dass keine davon erfolgreich war.
psql (9.5.6)
Type "help" for help.
postgres=# \list
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 |
template0 | postgres | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
testdb | postgres | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 |
(4 rows)
postgres=# dropdb template1
postgres-# \list
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 |
template0 | postgres | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
testdb | postgres | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 |
(4 rows)
postgres-# DROP DATABASE template1
postgres-# \list
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 |
template0 | postgres | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
testdb | postgres | UTF8 | en_CA.UTF-8 | en_CA.UTF-8 |
(4 rows)
Sie Template-Datenbanken nicht fallen, [etwa lesen sie.] (https://www.postgresql.org/docs/current/static/manage-ag-templatedbs.html) – klin