Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
6 Vastaukset
45436 Näkymät

How to drop database from ubuntu terminal.?.

Avatar
Hylkää
Paras vastaus
sudo -u postgres dropdb <name>

Explanation:

  • sudo -u postgres: run the next command impersonating the postgres user
  • dropdb <name>: command to drop a PosgreSQL database
Avatar
Hylkää

What if there is a space character in the database name?

Paras vastaus

You not just drop it from the webclient. Log in as administrator and drop using master password. Althernatively log into the pgAdmin III (PostgreSQL) and drop it from there. You will need admin access to in both scenarios

Avatar
Hylkää

yes,kaynis absolutely correct, but if we wish to drop it from the terminal itself, what we have to do?

Paras vastaus

open your terminal. type the command "dropdb database_name". Using this command you can drop your database

Avatar
Hylkää
Paras vastaus

when applied dropdb datname , but " \l "  command shows deleted datname in database list.

Avatar
Hylkää