CentOS version
LSB Version:: Core-4.1-amd64:core-4.1-noarch
Distributor Id:centos
Description:centos Linux release 7.0.1406 (Core)
release:7.0.1406
Codename:core
Note: CentOS installs PostgreSQL with Yum
The database program path is:/usr/pgsql-9.2
The database storage file path is:/var/lib/pgsql/
1. run:yum install Postgresql92-server Postgresql92-contrib
2. View: rpm-qa|grep PostgreSQL
3. initialization:/usr/pgsql-9.2/bin/postgresql92-setup initdb
4. enable:systemctl enable Postgresql-9.2.service (back to CD/ directory execution)
5. start:systemctl start Postgresql-9.2.service (start/restart/stop)
6. Login: su-postgres
PostgreSQL Database By default creates a postgres database user as the administrator of the database, the default password is empty, we need to change to the specified password, which is set to ' Postgres ' .
- Input: Psql
- Change Password:
# ALTER USER postgres with PASSWORD ' postgres ';
- Create a database
# CREATE DATABASE David;
- Switch database
# \c David
11. Modify the postgressql Database configuration for remote access
Modify the postgresql.conf file
# vi/var/lib/pgsql/9.2/data/postgresql.conf
If you want PostgreSQL to listen to the entire network, remove the # before listen_addresses and listen_addresses = ' localhost ' changed to listen_addresses = ' * '
12. Modify the Client Authentication profile pg_hba.conf
Add the IP address or address segment of the remote Access database to the file.
# vi/var/lib/pgsql/9.2/data/pg_hba.conf
Allow all host all 0.0.0.0/0 MD5
Restart the service for the settings to take effect
Create a User:
Create User Dbadmin
View System Users
SELECT * from Pg_shadow;
Exit
\q
CentOS 7 64-bit installation PostgreSQL 9.2 grooming