when i am trying to create postgres database with bash terminal on windows 11, im using below commands;
createdb 'test'
or
createdb -U postgres 'test'
and nothing happens.
i added the bin folder to paths in "environment variables" of windows. but it didnt solve the problem.
what am i doing wrong?
CodePudding user response:
1st solution:
sudo su - postgres
to become postgrespsql -c "create database demo"
to create it from shell
2nd 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
CodePudding user response:
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 :D (need restart, or just reopen your terminal)