Ubuntu Install, use PostgreSQL database
$ sudo apt-get install PostgreSQL
$ sudo passwd postgres (postgres account's home directory:/var/lib/postgresql)
Installing the Postgres Graphical client
$ sudo apt-get install pgadmin3 (call to enter pgadmin3 directly on the command line)
Main configuration files for Postgres
/etc/postgresql/9.1/main/pg_hba.conf (The Connection database authentication method) and postgresql.conf (the database
Configuration files) (before the proposed modifications are backed up)
The bin command path for PostgreSQL:
/usr/lib/postgresql/8.4/bin
Default does not write absolute path cannot be called, can do under soft link:
# ln-s/usr/lib/postgresql/8.4/bin/*/usr/bin/(some would have been, indifferent)
Postgres Database Storage Path:
/var/lib/postgresql/9.1/main/base (Note: This shows the OID of the database, not the database name)
To view the database name of the OID, execute the oid2name in the base directory
Start, close, and restart PostgreSQL
$ sudo service PostgreSQL Start\stop\restart
Under the Postgres account Command line, proceed as follows:
Create an Account
$ createuser-a-d-p-R user1
Password
Note:
-A does not allow other users to be created
-D does not allow database creation
-P Create password
-R does not allow roles to be created
Create a Database Ming
$ createdb Ming
Enter Database Ming
$ psql Ming
After entering the interface as follows
ming=#
The following steps are done in the database:
$ psql-u Postgres (can be psql directly under Postgres account)
Create an Account
postgres=# Create user "Ming" with password ' 123456 ' nocreatedb;
Establish the database and specify the owner
postgres=# CREATE DATABASE "Mingdb" with Owner= "Ming";
\l: Lists information such as owner,encoding for an existing database
\c database name: Switch database
\d: View existing tables in the current database
\d Table name: View table structure
\DU: List all users
\q: Exit
This article from "Linux" blog, declined reprint!
Ubuntu Install, use PostgreSQL database