postgresql 如何使用/打开 psql?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18888875/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 01:06:48  来源:igfitidea点击:

How to use/open psql?

postgresqlpostgresql-9.2psql

提问by Oto Shavadze

I have installed On windows 7 postgreSQL 9.2 version.

我已经在 Windows 7 postgreSQL 9.2 版本上安装了。

Now, I need use psql, so where is this terminal?

现在,我需要使用 psql,那么这个终端在哪里?

Can you tell me please how to use for example this comand: psql databasename?

你能告诉我如何使用例如这个命令:psql databasename

Where must be type this?

必须在哪里输入这个?

Yes, may be this is dumb question, but...

是的,这可能是个愚蠢的问题,但是......

回答by Viji

You can follow this instruction

您可以按照此说明

  1. Open the command prompt
  2. cd C:\postgresql-9.3.0-1-windows-x64-binaries\pgsql\bin (installed directory)
  3. Run: initdb -U postgres -A password -E utf8 -W -D POSTGRESQL_ROOT\data
  4. give super user password (Remember that)
  5. you wiil get the success message
  1. 打开命令提示符
  2. cd C:\postgresql-9.3.0-1-windows-x64-binaries\pgsql\bin(安装目录)
  3. 运行:initdb -U postgres -A 密码 -E utf8 -W -D POSTGRESQL_ROOT\data
  4. 给超级用户密码(记住)
  5. 您将收到成功消息

Success. You can now start the database server using:

成功。您现在可以使用以下命令启动数据库服务器:

"postgres" -D "POSTGRESQL_ROOT\data"

or "pg_ctl" -D "POSTGRESQL_ROOT\data" -l logfile start

或 "pg_ctl" -D "POSTGRESQL_ROOT\data" -l 日志文件开始

then, you are good to start the server

然后,您就可以启动服务器了

To stop the server : simply ctrl + c

要停止服务器:只需 ctrl + c

You can use pgAdmin tool(http://www.postgresql.org/ftp/pgadmin3/release/v1.8.4/win32/) somewhat similar like SQL Mgt Studio

您可以使用类似于 SQL Mgt Studio 的pgAdmin 工具(http://www.postgresql.org/ftp/pgadmin3/release/v1.8.4/win32/

Reference : http://www.petrikainulainen.net/programming/tips-and-tricks/installing-postgresql-9-1-to-windows-7-from-the-binary-zip-distribution/

参考:http: //www.petrikainulainen.net/programming/tips-and-tricks/installing-postgresql-9-1-to-windows-7-from-the-binary-zip-distribution/

回答by Hazrat ali

The easy way to start is

最简单的方法是

  1. Open Run Window by Winkey + R
  2. Type services.msc
  3. Search Postgres service based on version installed.
  4. Click stop, start or restart the service option.
  1. Winkey + R 打开运行窗口
  2. 键入 services.msc
  3. 根据安装的版本搜索 Postgres 服务。
  4. 单击停止、启动或重新启动服务选项。