dropdb - delete an existing PostgreSQL database

SYNOPSIS

dropdb [ option...] dbname

DESCRIPTION Description

dropdb delete an existing PostgreSQL database. Who executes this command must be a database superuser or the owner of the database.

dropdb is DATABASE SQL command the DROP [ DROP DATABASE package (7)] of. Therefore, delete the database in two ways are no different.

OPTIONS Options

dropdb accepts the following command line options:

dbname

 Name of the database you want to delete.
-e
--echo

 Echo dropdb generates commands and sends it to the server.
-i
--interactive

 Prompt before doing anything destructive.
-q
--quiet

 Not display a response.

 

createuser also accepts the following command line arguments for connection parameters:

-h host
--host host

 Host name of the machine running the server. If the value begins with a slash, it is used for the Unix domain socket.
-p port
--port Port

 Internet server is listening TCP port or local Unix domain socket file extension (descriptor).
-U username
--username username

 Username (username is not to be created) connection.
-W
--password

 Force a password prompt (the password server connections, not the new user's password.)

 

ENVIRONMENT Environment

PGHOST
PGPORT
PGUSER

 The default connection parameters.

DIAGNOSTICS diagnosis


 If the error, see DROP DATABASE [appear DROP DATABASE (7)] and  psql (1) for discussions of potential problems and error messages are described. The database server must be running on the target machine. Also, any default connection used by libpq front-end library settings and environment variables will apply.

EXAMPLES Examples


 Destroy the database demo on the default database server:

 

$ dropdb demo
DROP DATABASE


 Used on host eden server to delete the database demo, port 5000, with verification and command execution:

 

$ dropdb -p 5000 -h eden -i -e demo
Database "demo" will be permanently deleted.
Are you sure? (y/n) y
DROP DATABASE "demo"
DROP DATABASE

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11081415.html