个人总结:Centos 7 安装postgresql-10.15.1 常见问题解决
标题个人总结:Centos 7 安装postgresql-10.15.1 常见问题解决
如大家遇到其他问题,可以互相交流分享!!谢谢~~
1. 问题: postgresql is not in the sudoers file. This incident will be reported.
分析:新建的角色权限不足
解决办法:切换root用户,执行命令:visudo 或vi /etc/sudoers
(本质修改 /etc/sudoers文件)
su root
visudo 或vi /etc/sudoers
添加配置:postgresql ALL=(ALL) NOPASSWD:ALL
2. 问题: fixing permissions on existing directory /data/service/postgresql/data … initdb: could not change permissions of directory “/data/service/postgresql/data”: Operation not permitted
分析:文件夹或文件权限不够
chown -R postgresql.postgresql pgsql
3. 远程无法连接数据库
分析:配置 pgsql/data/postgresql.conf 和 pgsql/data/pg_hba.conf
解决办法:参考文章centos 7 设置远程连接 postgresql 10
4. 问题: psql.bin: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket “/tmp/.s.PGSQL.5432”?

分析:使用psql 使用数据库是报错,原因是因为数据库启动的端口是5433(我是用的是自动启动方式),使用psql命令时默认是5432 所以会出错
#启动命令
/software/pgsql/bin/pg_ctl -D /software/pgsql/data -l /software/pgsql/log/logfile -s -o "-F -p 5433" -w -t 300 start

解决:修改自动启动服务的文件,改为5432端口 或者 通过psql -p 5433使用数据库
更多推荐

所有评论(0)