Al usar este sitio, estás de acuerdo con el política de privacidad.
Aceptar
EnterineEnterineEnterine
  • HOGAR
  • TI PRO
  • TECNOLOGÍA
  • Microsoft
    • Azur
    • Administrador de configuración/SCCM
    • Dpm
    • orquestador
    • Hiper-V
    • Información privilegiada de Microsoft Edge
    • MSI
    • Oficina 365
    • Información privilegiada de la oficina
    • Energía BI
    • Skype
    • Servidor SQL
    • equipos
  • VENTANAS
    • Centro de administración de Windows
    • Cliente de Windows
    • Servidor Windows
  • Lista de recopilación de consultas SCCM
Lectura: Base de datos DROP de PostgreSQL
Cambiar tamaño de fuenteAutomóvil club británico
EnterineEnterine
Cambiar tamaño de fuenteAutomóvil club británico
  • HOGAR
  • TI PRO
  • TECNOLOGÍA
  • Microsoft
  • VENTANAS
  • Lista de recopilación de consultas SCCM
Buscar
  • HOGAR
  • TI PRO
  • TECNOLOGÍA
  • Microsoft
    • Azur
    • Administrador de configuración/SCCM
    • Dpm
    • orquestador
    • Hiper-V
    • Información privilegiada de Microsoft Edge
    • MSI
    • Oficina 365
    • Información privilegiada de la oficina
    • Energía BI
    • Skype
    • Servidor SQL
    • equipos
  • VENTANAS
    • Centro de administración de Windows
    • Cliente de Windows
    • Servidor Windows
  • Lista de recopilación de consultas SCCM
Postgresql

Base de datos DROP de PostgreSQL

Publicado: Febrero 18, 2024
4 Lectura mínima
COMPARTIR

Base de datos DROP de PostgreSQL.

Contenido
Using DROP DATABASESyntaxParametersEjemploUsing dropdb CommandSyntaxParametersOptionsEjemplo

Using DROP DATABASE

This command drops a database. It removes the catalog entries for the database and deletes the directory containing the data. It can only be executed by the database owner. This command cannot be executed while you or anyone else is connected to the target database (connect to Postgres or any other database to issue this command).

Syntax

The syntax for DROP DATABASE is given below −

DROP DATABASE [ IF EXISTS ] <name>

Parameters

The table lists the parameters with their descriptions.

S. No.Parameter & Descripción
1IF EXISTSDo not throw an error if the database does not exist. A notice is issued in this case.
2nombreThe name of the database to remove.

We cannot drop a database that has any open connections, including our own connection from psql o pgAdmin III. We must switch to another database or template1 if we want to delete the database we are currently connected to. De este modo, it might be more convenient to use the program dropdb instead, which is a wrapper around this command.

Ejemplo

The following is a simple example, which will delete testdb from your PostgreSQL schema −

DROP DATABASE testdb;

Using dropdb Command

PostgresSQL command line executable dropdb is a command-line wrapper around the SQL command DROP DATABASE. There is no effective difference between dropping databases via this utility and via other methods for accessing the server. dropdb destroys an existing PostgreSQL database. The user, who executes this command must be a database super user or the owner of the database.

Syntax

The syntax for dropdb is as shown below −

dropdb  [option...] <dbname>

Parameters

The following table lists the parameters with their descriptions

S. No.Parameter & Descripción
1dbnameThe name of a database to be deleted.
2opcióncommand-line arguments, which dropdb accepts.

Options

The following table lists the command-line arguments dropdb accepts −

S. No.Opción & Descripción
1-miShows the commands being sent to the server.
2-iIssues a verification prompt before doing anything destructive.
3-VPrint the dropdb version and exit.
4–if-existsDo not throw an error if the database does not exist. A notice is issued in this case.
5–helpShow help about dropdb command-line arguments, and exit.
6-h hostSpecifies the host name of the machine on which the server is running.
7-p portSpecifies the TCP port or the local UNIX domain socket file extension on which the server is listening for connections.
8-U usernameUser name to connect as.
9-wNever issue a password prompt.
10-WForce dropdb to prompt for a password before connecting to a database.
11–maintenance-db=dbnameSpecifies the name of the database to connect to in order to drop the target database.

Ejemplo

The following example demonstrates deleting a database from OS command prompt −

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

The above command drops the database testdb. Here, I have used the postgres (found under the pg_roles of template1) username to drop the database.

ETIQUETADO:databasedbPostgresqlpsql
Artículo anterior L1 L2 L3 What’s the Difference
Artículo siguiente Información privilegiada de la oficina 2206 para Windows
Deja un comentario Deja un comentario

Deja una respuesta Cancelar respuesta

Su dirección de correo electrónico no será publicada. Los campos obligatorios están marcados *

Este sitio utiliza Akismet para reducir el spam.. Descubra cómo se procesan los datos de sus comentarios.

Traducción

English中文(简体)DanskNederlandsFrançaisDeutschItaliano한국어PolskiPortuguêsRomânăEspañolУкраїнська
por Transposh - Plugin de traducción para WordPress

Publicaciones populares

Requisitos del sistema para Windows Server 2016
Servidor Windows
Lista de recopilación de consultas del Administrador de configuración
Lista de recopilación de consultas del Administrador de configuración
ConfigMgr
Navegación estructurada/administrada habilitada en páginas modernas en sitios de equipo clásicos
Técnico
SCCM no pudo obtener las ubicaciones de DP como la versión esperada de MP
ConfigMgr

Publicaciones recientes

Instalación y configuración de Fail2ban para protección SSH en Ubuntu 24.04
linux
Habilitación y configuración de FirewallD en AlmaLinux
linux
Creación de usuarios y configuración de claves SSH en AlmaLinux
linux
Cómo restablecer la contraseña en AlmaLinux
linux

© 2023 Enterine

Ir a la versión móvil
Bienvenido de nuevo!

Inicia sesión en tu cuenta

Nombre de usuario o dirección de correo electrónico
Contraseña

Perdiste tu contraseña?