标签:centos7安装 自动 切换 x86_64 tar 授权 yum image ini
sudo su - //root
rpm -aq| grep postgres
yum remove postgresql*
yum update
防止之后爆出Data directory is not empty!
rm -rf /var/lib/pgsql/12/data
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install postgresql12
yum install postgresql12-server
/usr/pgsql-12/bin/postgresql-12-setup initdb
这一步会自动创建/var/lib/pgsql/12/data文件夹
systemctl enable postgresql-12
systemctl start postgresql-12
systemctl status postgresql-12
su - postgres //as postgres user
create user test_user with password ‘abc123‘; // new user
create database test_db owner test_user; // new database
grant all privileges on database test_db to test_user; // grant
\q
systemctl restart postgresql-10.service
修改默认生成的 数据库用户postgres的密码
su - postgres
psql -U postgres
alter user postgres with encrypted password ‘123123‘;
CentOS7安装PostgreSQL12 + 完成本地访问
标签:centos7安装 自动 切换 x86_64 tar 授权 yum image ini
原文地址:https://www.cnblogs.com/daiweifan/p/13042552.html