Centos 7 安装 Postgresql数据库
敲入以下命令
# Install the repository RPM: sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm # Install PostgreSQL: sudo yum install -y postgresql14-server # Optionally initialize the database and enable automatic start: sudo /usr/pgsql-14/bin/postgresql-14-setup initdb sudo systemctl enable postgresql-14 sudo systemctl start postgresql-14
其他系统可以根据官网文档进行查阅
# 切换postgres用户 sudo su - postgres
##开启远程访问 #修改配置文件 取消 listen_addresses 的注释,将参数值改为“*” vi /var/lib/pgsql/14/data/postgresql.conf
#修改配置文件 增加一行 host all all 0.0.0.0/0 md5 vi /var/lib/pgsql/14/data/pg_hba.conf
#打开客户端,创建用户、数据库及用户授权
psql
create user test_zack with password '123456';
create database test_db owner test_zack;
grant all privileges on database test_db to test_zack;
#重启服务
sudo systemctl restart postgresql-14
本文作者:風飄絮℃
本文链接:https://www.cnblogs.com/zacklau/p/16573287.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步