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
How to use/open psql?
提问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
您可以按照此说明
- Open the command prompt
- cd C:\postgresql-9.3.0-1-windows-x64-binaries\pgsql\bin (installed directory)
- Run: initdb -U postgres -A password -E utf8 -W -D POSTGRESQL_ROOT\data
- give super user password (Remember that)
- you wiil get the success message
- 打开命令提示符
- cd C:\postgresql-9.3.0-1-windows-x64-binaries\pgsql\bin(安装目录)
- 运行:initdb -U postgres -A 密码 -E utf8 -W -D POSTGRESQL_ROOT\data
- 给超级用户密码(记住)
- 您将收到成功消息
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/)
参考: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
最简单的方法是
- Open Run Window by Winkey + R
- Type services.msc
- Search Postgres service based on version installed.
- Click stop, start or restart the service option.
- Winkey + R 打开运行窗口
- 键入 services.msc
- 根据安装的版本搜索 Postgres 服务。
- 单击停止、启动或重新启动服务选项。