问题解决: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 ...
随机推荐
- POJ3903 Stock Exchange LIS最长上升子序列
POJ3903 Stock Exchange #include <iostream> #include <cstdio> #include <vector> #in ...
- 5.1 Go函数定义
1 Go函数定义 Go函数是指:一段具有独立功能的代码,然后可以在程序中其他地方多次调用. Go分为自定义函数,系统函数. 函数可以将一个大的工作拆解成小的任务. 函数对用户隐藏了细节. Golang ...
- Mysql之Linux中mariadb主从复制
master主机mysql安装配置 1.下载mariadb(Centos7开始mysql的名字) (1)其它方式(不推荐):rpm安装/软件源安装 (2)yum安装(推荐): ①centos官方的yu ...
- 01 基础版web框架
01 基础版web框架 服务器server端python程序(基础版): import socket server=socket.socket() server.bind(("127.0.0 ...
- 使用php+mysql+xml完成一个调查问卷
本人根据php典型模块与项目实战大全此书所完成的一个调查问卷,同时管理员可以进行修改调查内容 同时用到了一个css文件,借鉴于 http://www.wufangbo.com/div-css-vote ...
- Appium自动化(15) - 针对 webview 进行自动化测试
如果你还想从头学起Appium,可以看看这个系列的文章哦! https://www.cnblogs.com/poloyy/category/1693896.html webview 简介 WebVie ...
- ASCII码排序(hdu2000)
思考:字符串的输入中是不包含空格的,所以可以用scanf_s("%字符类型占位符",&变量名,整型参数)来输入字符串. 因为scanf_s()函数的输入一遇到空格就会停止输 ...
- 10个典型的JavaScript面试题
问题1:作用域 考虑如下代码: JavaScript 1 2 3 4 5 6 7 (function() { var a = b = 5; })(); console.log(b) ...
- Mac 软件包管理器Homebrew使用指北
Homebrew Homebrew由开发者 Max Howell 开发,并基于 BSD 开源,是一个非常方便的软件包包管理器工具. Homebrew 官网 Homebrew 的几个核心概念 在正式介绍 ...
- 快速上手Alibaba Arthas
点击返回上层目录 原创声明:作者:Arnold.zhao 博客园地址:https://www.cnblogs.com/zh94 Arthas 本文主要聚焦于快速上手并使用Arthas,所以对于基本的概 ...