The drop database command is not working in sql shell. It shows db doesn't exists. But pgadmin and \l shows the db. What is the problem and how to delete the db?
not able to delete database in postgres
687 Views Asked by lupin At
2
There are 2 best solutions below
0
On
1.find . -path "/migrations/.py" -not -name "init.py" -delete
2.find . -path "/migrations/.pyc" -delete
[Instead of first 2 steps,you can
manually deleting all the files except init.py from migrations folder in all app.]
3.sudo su postgres
4.psql
DROP DATABASE databasename;
6.\q
7.createdb databasename
8.psql
9.grant all privileges on database databasename to username;
10.\q
11.exit
12.source venv/bin/activate
13.python manage.py makemigrations
14.python manage.py migrate
python manage.py createsuperuserpython manage.py runserver

Try writing
"myDatabase"(with quotation marks "") since your name is case-sensitive. In general it is better to use lower-case names in postgres and I think in unix in general.