安装postgresql
1、安装rpm文件
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
2、安装客户端yum install postgresql10
3、安装服务端yum install postgresql10-server
4、初始化/usr/pgsql-10/bin/postgresql-10-setup initdb
5、设置自动启动并且启动postgresql服务systemctl enable postgresql-10
systemctl start postgresql-10
6、使用postgres用户登录(PostgresSQL安装后会自动创建postgres用户,无密码)
su - postgres
2、登录postgresql数据库
psql
7、创建用户和数据库并授权
create user test_user with password 'abc123'; // 创建用户
create database test_db owner test_user; // 创建数据库
grant all privileges on database test_db to test_user; // 授权
8、退出psql(输入 \q 再按回车键即可)
\q
开启远程访问
1、修改/var/lib/pgsql/10/data/postgresql.conf文件,取消 listen_addresses 的注释,将参数值改为“*”

2、修改/var/lib/pgsql/10/data/pg_hba.conf文件,增加下图红框部分内容

3、切换到root用户,重启postgresql服务
systemctl restart postgresql-10.service
修改默认用户postgres的密码
1、修改默认生成的 postgres 用户密码(此postgres非上面的postgres用户,此为数据库的用户,上面的为操作系统的用户)
su - postgres
psql -U postgres
alter user postgres with encrypted password '1';
2、服务启动、关闭、重启、查看状态命令
systemctl start postgresql-10.service // 启动服务
systemctl stop postgresql-10.service // 关闭服务
systemctl restart postgresql-10.service // 重启服务
systemctl status postgresql-10.service // 查看状态
网友回复
有没有不依赖embedding向量的RAG技术?
有没有支持实时打断语音通话并后台帮你执行任何的ai模型?
开源ai大模型文件格式GGUF、MLX、Safetensors、 ONNX 有什么区别?
出海挣钱支付收款PayPal、Wise 、PingPong、Stripe如何选择?
如何实现类似google的图片隐形水印添加和识别技术?
linux上如何运行任意windows程序?
ai能写出比黑客还厉害的零日漏洞等攻击工具攻击任意软件系统工程?
js如何获取浏览器的音频上下文指纹、Canvas指纹、WebGL渲染特征?
为啥ai开始抛弃markdown文本,重新偏好html文本了?
网站有没有办法鉴别访问请求是由ai操控chrome-devtools-mcp发出的?


