postgres 安装基础
安装
- 环境: ubuntu
# Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Update the package lists:
sudo apt-get update
# Install the latest version of PostgreSQL.
# If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql':
sudo apt-get -y install postgresql
安装完后系统创建 postgres 账户, 使用 root 账户修改 他的密码 “passwd postgres 123 ”
默认配置在 “vi /etc/postgresql/13/main/postgresql.conf " .
修改登陆密码 “postgres=# alter user postgres with password ‘123’;” ,修改之后还修改在配置文件”/etc/postgresql/13/main/pg_hba.conf "修改 密码类型为 md5.
最后重启服务 “/etc/init.d/postgresql restart”