Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
6 ตอบกลับ
45437 มุมมอง

How to drop database from ubuntu terminal.?.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
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
อวตาร
ละทิ้ง

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

คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง

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

คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง