zoukankan      html  css  js  c++  java
  • PostgreSQL常见报错分析

    PostgreSQL常见报错分析

    1.进入数据库报错

    连接拒绝Connection refused

    [root@hg bin]# psql
    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"?
    

    解决办法
    查看PG数据库端口起来没有

    # ss -nuplt |grep:5432
    

    2.启动PG数据库报错

    # service postgresql-11 start
    Redirecting to /bin/systemctl start postgresql-11.service
    Job for postgresql-11.service failed because the control process exited with error code. See "systemctl status postgresql-11.service" and "journalctl -xe" for details.
    # journalctl -xe
    May 26 16:22:39 hg postgresql-check-db-dir[30320]: "/var/lib/pgsql/data" is missing or empty.
    May 26 16:22:39 hg postgresql-check-db-dir[30320]: Use "postgresql-setup initdb" to initialize the database cluster.
    May 26 16:22:39 hg postgresql-check-db-dir[30320]: See /usr/share/doc/postgresql-9.2.24/README.rpm-dist for more information.
    

    解决办法
    可以看到根本原因就是没有db,所以需要先初始化db。

    # chmod 754 /usr/bin/postgres-setup 
    # /usr/bin/postgresql-setup initdb
    
    #chmod 754 /usr/lib/systemd/system/postgresql.service
    启动PG数据库
    #systemctl  start  postgresql.service
    
  • 相关阅读:
    深入分析 Python 的垃圾回收机制
    9.26
    Web安全之ML--构建机器学习工具箱
    第八节--图的数据结构及其算法
    第七节--树形结构及其算法
    第六节--堆栈与队列算法
    第四节--查找与哈希算法
    第三节--排序算法
    第二节--常用数据结构
    第一节--走入算法的世界
  • 原文地址:https://www.cnblogs.com/Alicebat/p/12966619.html
Copyright © 2011-2022 走看看