create database, simplest way possible using psql commands

一世执手 提交于 2021-01-29 07:21:49

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!