设置PostgreSQL,无法连接到数据库postgres [英] Setting up PostgreSQL, could not connect to database postgres

查看:269
本文介绍了设置PostgreSQL,无法连接到数据库postgres的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将使用postgreSQL 9.2在Debian 7上创建一个django应用程序。
我在数字海洋中创造了一个小滴。我更新并升级了系统。
我使用以下命令

  sudo aptitude install postgresql postgresql-contrib 

安装postgresql。



当我将用户更改为postgres,我想创建一个新的db用户,具有 createuser -P



我填充了所有需要的字段,但它出现了这个错误:

  createuser:无法连接到数据库postgres:无法连接到服务器:没有这样的文件或目录
是服务器本地运行,并在Unix域套接字上接受
连接/var/run/postgresql/.s.PGSQL.5432?

我在Ubuntu 12.04和Debian 7中尝试使用新的液滴几次相同的过程。



我该怎么办?
我想使用Debian 7,所以我更喜欢与Debian的解决方案。
我是新的这个东西,所以请说明。
谢谢。

解决方案

我想到了修复区域设置问题并重新安装PostgreSQL



首先:
http ://perlgeek.de/en/article/set-up-a-clean-utf8-environment



第二:
如何彻底清除并重新安装ubuntu上的postgresql?



设置区域设置并为postgreSQL做一个干净的安装。



谢谢!


I will create a django app on Debian 7 with postgreSQL 9.2. I created a droplet in digital ocean. I updated and upgraded the system. I used the following command

sudo aptitude install postgresql postgresql-contrib

to install postgresql.

When I changed user to postgres and I wanted to create a new db user with createuser -P

I filled all the fields it wanted but it came up with this error:

createuser: could not connect to database postgres: 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.5432"?

I tried same process a few times with new droplets in Ubuntu 12.04 and Debian 7.

What should I do? I want to use Debian 7, so I prefer solutions with Debian. I am new at this stuff so be explanatory please. Thanks.

解决方案

I figured it out with fixing locale problem and reinstall PostgreSQL

First: http://perlgeek.de/en/article/set-up-a-clean-utf8-environment

Second: How to thoroughly purge and reinstall postgresql on ubuntu?

Set up the locale and make a clean installation for postgreSQL.

Thanks!

这篇关于设置PostgreSQL,无法连接到数据库postgres的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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