问题解决: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.5432"?
错误提示:
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.5432"?
出现该问题的很多,以下是目前碰到的几种情况,之后碰到继续补充:
1.删除了/tmp路径中的.s.PGSQL.5432 与.s.PGSQL.5432.lock文件
解决:重启数据库 $sudo service postgresql restart
2.修改监听端口:
之前用5434监听,后来改为5432,数据库启动,但是psql无法进入数据库,通过psql -p 5432可以进入。
解决:安装时配置了端口PGPORT。修改~/.bash_profile或/etc/profile文件中的端口指定。
3.修改了postgresql.conf 中的unix_socket_directories
分析见两篇博文:
http://francs3.blog.163.com/blog/static/40576727201332594924829/
http://blog.csdn.net/huguangshanse00/article/details/40413549
引用其中:
"先来看看 socket 文件 "/tmp/.s.PGSQL.1921",其中 1921 是 pg 的端口号; socket 文件可以通过
postgresql.conf 文件以下参数配置:
#unix_socket_directory = ''
#unix_socket_permissions = 0777
备注:其中参数 unix_socket_directory 用来配置 socket 文件的目录,默认是 /tmp 目录,参数
unix_socket_permissions 用来设置 socket 文件的权限。"
解决方法:指定host,用psql -h 连接
问题解决: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.5432"?的更多相关文章
- 问题解决: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.5432"?
错误提示: psql: could not connect to server: No such file or directory Is the server running locally and ...
- libpqxx接口的在linux下的使用,解决psql:connections on Unix domain socket "/tmp/.s.PGSQL.5432"错误
在项目中使用postgresql数据库时要求在windows和linux双平台兼容.于是在windows下使用的接口在linux下爆出异常: psql:connections on Unix doma ...
- psql: could not connect to server: No such file or directory&&PGHOST
由于环境变量 PGHOST配置不当引起的 postgres@pgdb-> psql psql: could not connect to server: No such file or dire ...
- psql: could not connect to server: No such file or directory
postgresql报错: psql: could not connect to server: No such file or directory Is the server run ...
- 解决:error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
在使用 deamon@deamon-H55M-S2:/usr/bin$ mysqladmin -u root -p shutdown 关闭MySQL之后试图通过: deamon@deamon-H55M ...
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)-mysql.sock丢失解决方案
我们的LAMP是搭建在UBUNTU 12.04 LTS上的. LAMP是通过编译的方式进来安装的. 在一次处理意外挂机时由于未知的原因在重启后发现无法连接数据库了, 在打开网站时出现如下的的提示: E ...
- Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'解决
安装上mysql后,报 Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock',试了网上的方法 ...
- OperationalError: (2002, “Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)”)
OperationalError: (2002, “Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld ...
- Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock’
今天服务器遇到了一个很熟悉的问题 输入 #mysql -u root -p ERROR 2002 (HY000): Can't connect to local MySQL server throug ...
随机推荐
- Redmine 插件安装
将对应的插件都复制进redmine的plugins 安装对应所需要的GEMS bundle install --without development test rmagick 执行插件合并 bund ...
- ACM失败之路
校赛打完,已过四月,该是准备背起行囊,踏上考研之路了,自然,得先阔别一下ACM了,想起这几年ACM路,感慨颇多,不得不一诉心肠,与大家分享一下我的ACM历程,如果有人能从此文获取一些益处,那我就很欣慰 ...
- ListView中动态显示和隐藏Header&Footer
ListView的模板写法 ListView模板写法的完整代码: android代码优化----ListView中自定义adapter的封装(ListView的模板写法) 以后每写一个ListView ...
- jdbc java数据库连接 3)Statement接口之执行DDL和DML语句的简化
上一章的代码中,可以发现,jdbc执行DDL和DML有几个步骤都是一样的: 1)执行语句开始时,创建驱动注册对象.获取连接的数据库对象.创建Statement对象 // 创建驱动注册对象 Class. ...
- GL_ARRAY_BUFFER 和 GL_ELEMENT_ARRAY_BUFFER
转载请注明出处.系列教程: webgl-lesson.wysaid.org 第七话, 了解OpenGL的几种Array Buffer,实现大量顶点的批量绘制, 以及映射纹理坐标 每一话都间隔很久,其实 ...
- document.forms用法
1.FF中不能接受document.forms("formname")的使用,ie中可以 最好改成document.forms["formname"]的下标用法 ...
- 【LeetCode】241. Different Ways to Add Parentheses
Different Ways to Add Parentheses Given a string of numbers and operators, return all possible resul ...
- android应用内存占用测试(每隔一秒打印procrank的信息)
1.内存占用 对于智能手机而言,内存大小是固定的:因此,如果单个app的内存占用越小,手机上可以安装运行的app就越多:或者说app的内存占用越小,在手机上运行就会越流畅.所以说,内存占用的大小,也是 ...
- js的this上下文的坑
很明显,this这个坑,在多层嵌套的时候还是一样被废,不管是call, apply还是bind. 例如: var fun = function() { this.name = 'test'; var ...
- c#如何实现一个线程暂停,等待用户输入文本后继续运行?
using System; using System.Text; using System.Windows.Forms; using System.Threading; namespace Windo ...