无法连接到服务器:适用于Linux的Windows子系统中ubuntu上的Postgresql [英] Unable to connect to server: postgresql on ubuntu in windows subsystem for linux

查看:407
本文介绍了无法连接到服务器:适用于Linux的Windows子系统中ubuntu上的Postgresql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将WSL与ubuntu 18.04发行版一起使用,以重击方式击中sudo -u postgres psql 我收到以下错误:

I'm using WSL with an ubuntu 18.04 distribution, in the bash I hit sudo -u postgres psql I get the following error:

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"?

然后我尝试了其他postgres操作,例如:sudo -u createdb mydb 只得到相同的错误.

Then I tried other postgres operations like: sudo -u createdb mydb only to get the same error.

请告知.

推荐答案

在Linux的Windows子系统中的Ubuntu上运行PostgreSQL时,可能必须手动启动数据库服务器才能进行连接.使用下面的命令启动数据库服务器,然后尝试连接.

When running PostgreSQL on Ubuntu in Windows Subsystem for Linux, you may have to manually start the db server before you can connect. Use the command below to start your db server and then try connecting.

sudo /etc/init.d/postgresql start

这篇关于无法连接到服务器:适用于Linux的Windows子系统中ubuntu上的Postgresql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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