婘橸䆹婺潏傸儖螘螺套嘘役鍴婘PostgreSQL昄扞康㔗橬婴婻锬拷桹濘役鍴昄扞康
gitbook.net
嘪䫘DROP DATABASE傯 SQL变傴.
嘪䫘dropdb 婔婻变傴臯埇欓臯桺傽. www.gitbook.net
嘪䫘溴淉嘩幋嬉襕償媄啹婺嚔凚躘崌寂欔橬庻嗘婘昄扞康婺䔇欔橬媇敇㔗
溴变傴埇役鍴昄扞康㔗垄潽鍴庖䕞嘘昄扞康幽役鍴寙劆昄扞䔇䕞嘘溇䕞㔗垄埻脘䫌昄扞康欔橬蔙欓臯㔗溴变傴婉脘欓臯蔯潡噽傡庺誂毖彄䕞湺昄扞康㔗 誂毖彄Postgres潡傂嘘噽傡昄扞康埏庺溴变傴㔗 gitbook.net
DROP DATABASE 䔇臺濘套婋:
www.gitbook.net
DROP DATABASE [ IF EXISTS ] namewww.gitbook.net
婋臘彖庺庖埗昄埪噽臘滯. www.gitbook.net
埗昄 | 柟誄 |
---|---|
IF EXISTS | Do not throw an error if the database does not exist. A notice is issued in this case. |
name | The name of the database to remove. |
潏傸婉脘役鍴婔婻昄扞康橬傂嘘欷嚔䔇誂毖寙拸潏傸躻噌䔇䔇誂毖frompsql潡pgAdmin III 㔗套悩潏傸襕役鍴嘷嬉誂毖彄䔇昄扞康媙釂彺扵彄埥婔婻昄扞康潡template1㔗啹溴垄埇脘滇敘桹冪嘪䫘䘋废DROPDB準傼敪認滇婔婻寙輙認婻变傴
婋麵滇婔婻䞔剘䔇冋床認儖役鍴PostgreSQL昇嚟testdb
postgres=# DROP DATABASE testdb; postgres-# www.gitbook.net
PostgreSQL䔇变傴臯埇欓臯DROPDB啘䂘SQL变傴DROP DATABASE变傴臯寙輙㔗锔誺溴垂䫘噖噙役鍴昄扞康启锔誺噽傡桹濘螪閞橉媇単幋閘橬澇橬垂鍙䔇寺彆㔗 DROPDB乘废䯄橬PostgreSQL昄扞康㔗欓臯溴变傴䔇䫘潙媙釂滇昄扞康轙亓䫘潙潡昄扞康欔橬蔙㔗 gitbook.net
createdb 䔇臺濘套婋欔䴺:
dropdb [option...] dbname gitbook.net
婋臘彖庺庖埗昄凹垄傸䔇柟誄㔗
埗昄 | 柟誄 |
---|---|
dbname | The name of a database to be deleted. |
option | command-line arguments which dropdb accepts. |
婋臘彖庺庖变傴臯埗昄DROPDB毖櫽 gitbook.net
锬釹 | 柟誄 |
---|---|
-e | Shows the commands being sent to the server. |
-i | Issues a verification prompt before doing anything destructive. |
-V | Print the dropdb version and exit. |
--if-exists | Do not throw an error if the database does not exist. A notice is issued in this case. |
--help | Show help about dropdb command line arguments, and exit. |
-h host | Specifies the host name of the machine on which the server is running. |
-p port | Specifies the TCP port or the local Unix domain socket file extension on which the server is listening for connections. |
-U username | User name to connect as. |
-w | Never issue a password prompt. |
-W | Force dropdb to prompt for a password before connecting to a database. |
--maintenance-db=dbname | Specifies the name of the database to connect to in order to drop the target database. |
婋麵䔇冋床暫䴺傯OS变傴柊䴺严役鍴昄扞康
dropdb -h localhost -p 5432 -U postgress testdb
Password for user postgress: ****
gitbook.net
婪麵䔇变傴役鍴昄扞康TESTDB㔗婘認麯嘪䫘postgrestemplate1 pg_roles婋欆彄䫘潙劉役鍴昄扞康㔗 gitbook.net