Unable to connect to server: postgresql on ubuntu in windows subsystem for linux

孤人 提交于 2019-12-21 05:38:07

问题


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

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

Please advise.


回答1:


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



来源:https://stackoverflow.com/questions/51954332/unable-to-connect-to-server-postgresql-on-ubuntu-in-windows-subsystem-for-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!