I cannot access PostgreSQL through the command line in Windows. (我无法通过Windows中的命令行访问PostgreSQL。) Although I am able to create and update the databases, access them through PGAdminIII, and push to Heroku, I am unable to access them directly through my command line using the psql command. (尽管我能够创建和更新数据库,可以通过PGAdminIII访问它们并推送到Heroku,但是我无法使用psql命令通过命令行直接访问它们。)
When I try to create a database by using the command (当我尝试使用命令创建数据库时)
$ createdb mydb
as explained in the PG documentation , I get the message (如PG文档中所述,我收到消息)
createdb: command not found
The documentation suggests that in this case, "PostgreSQL was not installed properly. Try calling the command with an absolute path instead." (文档建议在这种情况下,“未正确安装PostgreSQL。请尝试使用绝对路径调用该命令。”) Sure enough, I am able to create a database by entering the direct path to the file: (当然,我可以通过输入文件的直接路径来创建数据库:)
$ c:/postgreSQL/9.1/bin/createdb mydb
Does this mean that the path can be reconfigured to connect correctly? (这是否意味着可以重新配置路径以正确连接?) Or do I need to reinstall? (还是需要重新安装?) I've reinstalled several times, and have not been able to set the correct path. (我已经重新安装了几次,但无法设置正确的路径。) I currently have both the /bin and /lib paths addedto my system and user(:Umezo) paths, but still no access from the command line. (我目前在系统路径和用户(:Umezo)路径中都添加了/ bin和/ lib路径,但是仍然无法从命令行进行访问。)
User variables for umezo
variable name: Path
variable value: C:PostgreSQL9.1in; C:PostgreSQL9.1lib
System variables
variable name: Path
variable value: C:PostgreSQL9.1in; C:PostgreSQL9.1lib
Any information or feedback regarding how I can fix my installment would be appreciated. (关于如何修理我的分期付款的任何信息或反馈,将不胜感激。)
My info is as below: (我的信息如下:)
I mostly followed these sources here and here . (我在这里和这里主要关注这些资源。) I installed a 32 bit version of 9.1 because some sources suggested issues with 64 bit. (我安装了9.1的32位版本,因为某些资料显示64位存在问题。)
PG download version: Installer Version 9.1 Win x86-32
Operating System: Windows 7 (64 bit)
pg_hba.conf (pg_hba.conf)
#TYPE DATABASE USER CIER-ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
postgresql.conf (postgresql.conf)
# - Connection Settings -
listen_addresses = '*'
port = 5432
max_connections = 100
pg_ident.conf (pg_ident.conf)
# *Everything is commented out*
Login Role Umezo #from properties window in PGAdminIII (PGAdminIII中“属性”窗口中的 登录角色Umezo #)
Properties/Role name: Umezo
Properties/Can login: "check"
Role privileges: all categories "check"
ask by umezo translate from so