怎么启动postgresql服务器

643次阅读
没有评论

怎么启动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

 Python学习网,大量的免费PostgreSQL入门教程,欢迎在线学习!

神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:postgresql2022-12-02发表,共计440字。
新手QQ群:570568346,欢迎进群讨论 Python51学习