问题
So I installed postgreSQL version 9.2.4 using the default installer settings on Windows 7 64 bit. Then I launched the SQL Shell(psql) command line tool and enter all the defaults plus the password I used during the install. It logs in. The problem is that a database cannot be created, or so it appears.
I typed in creatdb mydb
also tried CREATE DATABASE mydb
I assume something happens, but when I type \list I just see the default installed databases.
Am I missing something here? Coming from MySQL and this simple task is puzzling. No errors, nothing.
回答1:
Perhaps you should give the tutorial a try first: http://www.postgresql.org/docs/9.2/interactive/tutorial.html
Specifically, this part: http://www.postgresql.org/docs/9.2/interactive/tutorial-createdb.html
$ createdb mydb
Alternatively from the psql console:
CREATE DATABASE mydb; -- note the ; at the end
来源:https://stackoverflow.com/questions/16906932/create-database-simplest-way-possible-using-psql-commands