Linux在线安装PostgreSQL、离线安装及基本使用
PostgreSQL在线安装
安装
-
点击Download
-
根据需要选择相应系统
4.我这选的是基于CentOs7 版本是11.0,然后下面就会有安装的脚本,按照脚本一步一步执行就可以安装好
5.安装
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y postgresql11-server
//初始化数据库
sudo /usr/pgsql-11/bin/postgresql-11-setup initdb
//设置开机自启
sudo systemctl enable postgresql-11
//启动
sudo systemctl start postgresql-11
6.查看状态
systemctl status postgresql-11
使用
1.默认的超级数据账号是 postgres,第一次登陆修改密码
su postgres
psql
// 修改密码
ALTER USER postgres WITH PASSWORD 'postgres';
// 退出
\q
exit