Postgresql creating database

女生的网名这么多〃 提交于 2021-02-06 10:12:32

问题


Well I installed the latest postgreql database on my Windows 7.

Now I'm trying to create a database via the psql.exe command line

When I open it, it says

psql: FATAL: database "Jansu" does not exist

So I read somewhere, that when no database is specified, it tried to find database with my username or something.

Anyways..how do i create a new database, when I can't access the commandline.


回答1:


Read psql syntax. You can specify database, user and other parameters. If it's a new installation, there should be a default database 'postgres', you can connect to that one.

 psql -U postgres postgres 

(In Unix environments you might need to add -h localhost in order to force a TCP connection, otherwise it'd try to use Unix-domain sockets, which might not work for other than the postgres user. )

You can create databases from there, or from the command line with createdb



来源:https://stackoverflow.com/questions/5735370/postgresql-creating-database

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