Ste*_*ter 3 postgresql windows-subsystem-for-linux
stackoverflow 上似乎有很多类似的问题,但似乎没有一个对我有帮助。我正在我的 Windows Linux 子系统上运行 Ubuntu 并尝试安装和使用 postgresql。
我是这样安装的:
sudo apt-get install postgresql postgresql-contrib postgresql-client
pgadmin3
Run Code Online (Sandbox Code Playgroud)
效果很好:
安装日志底部附近显示:
Creating new cluster 9.5/main ...
config /etc/postgresql/9.5/main
data /var/lib/postgresql/9.5/main
locale C
socket /var/run/postgresql
port 5433
update-alternatives: using /usr/share/postgresql/9.5/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
invoke-rc.d: could not determine current runlevel
Setting up postgresql (9.5+173) ...
Setting up postgresql-client (9.5+173) ...
Setting up postgresql-contrib-9.5 (9.5.8-0ubuntu0.16.04.1) ...
Setting up postgresql-contrib (9.5+173) ...
Processing triggers for systemd (229-4ubuntu16) ...
Processing triggers for ureadahead (0.100.0-19) ...
Run Code Online (Sandbox Code Playgroud)
所以端口是 5433。这也是 postgresql.conf 文件中列出的端口。
当我输入时psql我得到:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5433"?
Run Code Online (Sandbox Code Playgroud)
当我做:
ps -df | grep postgres
我得到了一个不同的端口(5432)并且返回了:
spotter 12 2 0 18:55 tty1 00:00:00 /usr/lib/postgresql/9.5/bin/psql -h 199.92.170.64 -d rtu_prod -Usv-read -p 5432
spotter 1835 2 0 20:21 tty1 00:00:00 grep --color=auto -a postgres
spotter 6134 2 0 20:51 tty1 00:00:00 grep --color=auto -a postgres
spotter 9348 2 0 22:06 tty1 00:00:00 grep --color=auto postgres
Run Code Online (Sandbox Code Playgroud)
我认为这可能意味着我安装了两个版本的 postgresql 但我不确定。
根据其他帖子,我应该输入/usr/lib/postgresql/9.5/bin/psql -h 199.92.170.64 -d rtu_prod -Usv-read -p 5432才能启动它,但这要求输入我从未听说过的密码Password for user sv-read:
PostgreSQL 与 WSL 配合得很好。要完全运行它,请按照下列步骤操作:
安装步骤:
sudo apt updatesudo apt install postgresql postgresql-contribsudo service postgresql startsudo -i -u postgrespsqlpsql 的用户设置:
CREATE USER <Your User name> WITH PASSWORD '<Your Password>';CREATE DATABASE <Your database> WITH OWNER <Your User name>;\password postgres| 归档时间: |
|
| 查看次数: |
3276 次 |
| 最近记录: |