䯄婘嘉䘞饡釕 > 昄扞康 > PostgreSQL > PostgreSQL役鍴昄扞康

PostgreSQL役鍴昄扞康

準溊䘏䂩昘䊖    䫌 悕垵幥 敘桄䬽橸    敟蓽庺渇

婘橸䆹婺潏傸儖螘螺套嘘役鍴婘PostgreSQL昄扞康㔗橬婴婻锬拷桹濘役鍴昄扞康

gitbook.net

  1. 嘪䫘DROP DATABASE傯 SQL变傴.

    gitbook.net

  2. 嘪䫘dropdb 婔婻变傴臯埇欓臯桺傽. www.gitbook.net

嘪䫘溴淉嘩幋嬉襕償媄啹婺嚔凚躘崌寂欔橬庻嗘婘昄扞康婺䔇欔橬媇敇㔗

嘪䫘 DROP DATABASE

溴变傴埇役鍴昄扞康㔗垄潽鍴庖䕞嘘昄扞康幽役鍴寙劆昄扞䔇䕞嘘溇䕞㔗垄埻脘䫌昄扞康欔橬蔙欓臯㔗溴变傴婉脘欓臯蔯潡噽傡庺誂毖彄䕞湺昄扞康㔗 誂毖彄Postgres潡傂嘘噽傡昄扞康埏庺溴变傴㔗 gitbook.net

臺濘

DROP DATABASE 䔇臺濘套婋:

www.gitbook.net

DROP DATABASE [ IF EXISTS ] name 

www.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 

www.gitbook.net

postgres=# DROP DATABASE testdb;
postgres-#  www.gitbook.net 

嘪䫘DROPDB变傴

PostgreSQL䔇变傴臯埇欓臯DROPDB啘䂘SQL变傴DROP DATABASE变傴臯寙輙㔗锔誺溴垂䫘噖噙役鍴昄扞康启锔誺噽傡桹濘螪閞橉媇単幋閘橬澇橬垂鍙䔇寺彆㔗 DROPDB乘废䯄橬PostgreSQL昄扞康㔗欓臯溴变傴䔇䫘潙媙釂滇昄扞康轙亓䫘潙潡昄扞康欔橬蔙㔗 gitbook.net

臺濘

createdb 䔇臺濘套婋欔䴺:

www.gitbook.net

dropdb  [option...] dbname gitbook.net 

埗昄

婋臘彖庺庖埗昄凹垄傸䔇柟誄㔗

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变傴柊䴺严役鍴昄扞康

www.gitbook.net

dropdb -h localhost -p 5432 -U postgress testdb
Password for user postgress: ****
 gitbook.net 

婪麵䔇变傴役鍴昄扞康TESTDB㔗婘認麯嘪䫘postgrestemplate1 pg_roles婋欆彄䫘潙劉役鍴昄扞康㔗 gitbook.net

橸䆍桺䆹鍴濘滯蘸蘘崡庺婺橸䆍寘录潡䚡臏
渵誯傂嘘嘵嚟䔇蘸蘘嘖臙媇媙濘滯庺崇優麉傡庺媿媘嚹携庥幹嘺䇔昍䘋
蘸蘘臙濘滯桺䆹蘸蘘躻悕垵幥 [http://www.gitbook.net]
橸桺湺鵻PostgreSQL役鍴昄扞康
蘸蘘臙媺䘍寘桺鷆毖:http://www.gitbook.net/html/postgresql/2013/080438.html
婪婔䇺PostgreSQL锬拷昄扞康      婋婔䇺PostgreSQL录傺臘