for me I used Windows command directly, could you first try cd directly to your postgresql bin folder (I suppose createdb application must be there), then try using createdb command. If it works, there must be some wrong config with your Env variable 😀 (need restart, or just reopen your terminal)
2
Answers
1st solution:
sudo su - postgres
to become postgrespsql -c "create database demo"
to create it from shell2nd solution:
Just simply enter the following commands on bash:
$
createdb -U postgres(db user) dbname
If you set hba_config in pg for the access to the db in network type:
$
createdb -h YOUR_IP -U postgres(db user) dbname
Lastly, if you set password for db user, pg will ask your password to create database.
Note: If nothing works from above, double-check your system environment variables
for me I used Windows command directly, could you first try
cd
directly to yourpostgresql bin
folder (I supposecreatedb
application must be there), then try usingcreatedb
command. If it works, there must be some wrong config with your Env variable 😀 (need restart, or just reopen your terminal)