Today, install the PostgreSQL database under centos6.5, and now tidy up your own procedures.
I. Installation of postgresql9.4 under Centos6.5
1.1. Display all the relevant PostgreSQL installation packages
Yum List postgres*
1.2. Install the database
Yum Install Postgresql94-server
1.2. Initializing the database (initializing the database default path in/var/lib/pgsql/9.4/data)
Service Install postgresql-9.4 Initdb
1.3. Start the service
Service postgresql9.4 Start
Two. PostgreSQL Database password settings
2.1. Switch user to Postgres
Su-postgres
2.2. Connect to the database
Psql-u Postgres
3.3. Set a password for the user name
\password Postgres (Set password)
Alter user postgres with password ' 123456 ' (modified)
3.4. Modify the default authentication method (important)
In/var/lib/pgsql/data/pg_hba.conf, the default validation method
Host all 127.0.0.1/32 ident
Change to password verification
Host All 127.0.0.1/32 MD5
3.5. Restart the database
Systemctl Restart PostgreSQL
3.6. New User Login
Psql-u postgres-h 127.0.0.1
Four. Database import and Export command
4.1. Backup
To back up the database:
-bash-3.2$ pg_dump Music >/tmp/music.dmp
To view the backup:
-bash-3.2$ cd/tmp/
-bash-3.2$ ls
4.2. Import
Psql-u postgres (user name) database name (default is the same as user name) </data/dum.sql
PostgreSQL centos6.5 installation and common commands