postgresql服务器的启动


当postgres服务器没有启动时,psql命令会报错:

psql: 无法联接到服务器: 没有那个文件或目录 服务器是否在本地运行并且在 Unix 域套接字 "/var/run/postgresql/.s.PGSQL.5432"上准备接受联接?

 

解决办法:

通过命令

/etc/init.d/postgresql start

启动postgres服务器。

收到信息

[ ok ] Starting postgresql (via systemctl): postgresql.service.

表示成功启动。

 

然后通过

sudo su - postgres

切换到用户postgres。

postgres用户下使用psql命令可进入数据库操作。

 

另:

停止postgres服务器:

/etc/init.d/postgresql stop 

重启postgres服务器:

/etc/init.d/postgresql restart

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM