How can I delete a PostgreSQL database?



I have been trying to delete databases from my PostgreSQL service, I started the service, ran

sudo sudo -u postgres psql

Listed my databases with


But whenever I run DROP DATABASE mydatabasename; I get

postgres-# DROP DATABASE mydatabasename; ERROR: syntax error at or near "DATABASE"

I also tried with dropdb but it doesn’t work, how could I overcome this problem?

Thank you!


What happens when you try with dropdb? Can you please share the commands you are running, where you are running them and all returned output?