如何设置在Cygwin中psql的命令? [英] how to set up the psql command in cygwin?

查看:207
本文介绍了如何设置在Cygwin中psql的命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的机器与Apache服务器和PostgreSQL 9.1数据库在本地开发站点。当我使用Windows,我也安装了Cygwin。我要访问数据库,并通过III的pgAdmin的欧洲工商管理学院的Cygwin某些查询,但它告诉我没有发现psql的命令。我应该如何在Cygwin中设置psql的命令?

I have a local dev site on my machine with Apache server and PostgreSQL 9.1 database. As I'm using Windows, I also installed Cygwin. I want to access to database and make some queries via Cygwin insead of pgAdmin III, but it tells me that psql command not found. How should I set up the psql command in cygwin?

推荐答案

有关Cygwin的Windows上的最佳组合,我发现,是正常的Windows安装的Postgres与Cygwin的psql的结合。

The best combo for Cygwin on Windows, I've found, is the normal Windows Postgres installation combined with Cygwin psql.

Cygwin的PSQL(和其他命令行工具),可以从源代码很容易被编译。下面是步骤9.2.4:

Cygwin psql (and other command-line tools) can be compiled from source fairly easily. Here's the steps for 9.2.4:

$ wget http://ftp.postgresql.org/pub/source/v9.2.4/postgresql-9.2.4.tar.bz2
$ tar xjf postgresql-9.2.4.tar.bz2
$ cd postgresql-9.2.4/
$ ./configure
$ cd src/bin/psql
$ make

这将创建一个psql.exe二进制与Cygwin的效果很好。然而,在默认情况下,它会尝试连接到使用Unix套接字而非TCP本地实例。因此,使用-h指定主机名和TCP力,例如:

This creates a psql.exe binary that works well with Cygwin. However, by default, it tries to connect to the local instance using a Unix socket instead of TCP. So use -h to specify the hostname and force TCP, for example:

$ ./psql -h localhost -U postgres

移动路径(如〜/ bin)中对这个psql.exe在某处,并在脚本可能换到增加对供应没有其他参数时方便本地主机-h。

Move this psql.exe to someplace on your path (e.g. ~/bin) and possibly wrap in a script to add '-h localhost' for convenience when no other arguments supplied.

来源可能被修改,以更改默认,但这需要实际工作;)

The source could be modified to change the default, but that takes actual work ;)

这篇关于如何设置在Cygwin中psql的命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆